Shopify - started getting 404 exceptions when updating variants - shopify

i've had my first Shopify store running for about a month now, using a PHP batch script to either create new products and variants, or to update as and when needed from an existing web-based product management system. All seems to have been running fine but i've just noticed that i'm getting an exception thrown when updating variants. I'm sure this has been working fine previously (been able to update a variant as needed) so I could do with a bit of help figuring out why this is failing now.
Here's an example:
ShopifyApiException Object
(
[method:protected] => PUT
[path:protected] => /admin/variants/4294967295.json
[params:protected] => Array
(
[variant] => Array
(
[price] => 8.00
[sku] => 2217
[id] => 2217
[product_id] => 21880
[inventory_management] => shopify
[inventory_policy] => deny
[inventory_quantity] => 1
[option1] => Plain \/ EX
[option2] => Strictly Rhythm
[option3] => SR12216
[weight] => 330
[weight_unit] => g
)
)
[response_headers:protected] => Array
(
[http_status_message] => Not Found
[http_status_code] => 404
[server] => nginx
[date] => Fri, 21 Aug 2015 14:27:03 GMT
[content-type] => application/json; charset=utf-8
[transfer-encoding] => chunked
[connection] => keep-alive
[vary] => Accept-Encoding
[x-sorting-hat-podid] => 3
[x-sorting-hat-shopid] => 2234339
[x-sorting-hat-podid-cached] => 1
[x-sorting-hat-shopid-cached] => 1
[status] => 404 Not Found
[x-frame-options] => DENY
[x-shopid] => 2234339
[x-shardid] => 3
[x-shopify-shop-api-call-limit] => 1/40
[http_x_shopify_shop_api_call_limit] => 1/40
[x-stats-userid] => 0
[x-stats-apiclientid] => 152673
[x-stats-apipermissionid] => 3265975
[x-xss-protection] => 1; mode=block; report=/xss-report/97471013-3a3c-4b82-a94d-868f9b7ac073?source%5Baction%5D=update&source%5Bcontroller%5D=admin%2Fproduct_variants&source%5Bsection%5D=admin
[set-cookie] => request_method=PUT; path=/
[x-request-id] => 97471013-3a3c-4b82-a94d-868f9b7ac073
)
[response:protected] => Array
(
[errors] => Not Found
)
[message:protected] => Not Found
[string:Exception:private] =>
[code:protected] => 404
[file:protected] => /var/www/MY-SERVER/httpdocs/shopify_tools/shopify.php
[line:protected] => 70
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /var/www/MY-SERVER/httpdocs/shopify_tools/batch_upload_items.php
[line] => 347
[function] => call
[class] => ShopifyClient
[type] => ->
[args] => Array
(
[0] => PUT
[1] => /admin/variants/4294967295.json
[2] => Array
(
[variant] => Array
(
[price] => 8.00
[sku] => 2217
[id] => 2217
[product_id] => 21880
[inventory_management] => shopify
[inventory_policy] => deny
[inventory_quantity] => 1
[option1] => Plain \/ EX
[option2] => Strictly Rhythm
[option3] => SR12216
[weight] => 330
[weight_unit] => g
)
)
)
)
)
[previous:Exception:private] =>
)

I've realised the problem - hopefully this may help someone else.
I was storing the Shopify Variant ID in an INT column in my database and Shopify Variant IDs have just recently passed the INT limit of 4294967295 - switching to BIGINT and reimporting all the Variant IDs solved the problem.

Related

How to get store link with Bigcommerce API

How on installation step I can get store url? Because store hash is not the thing I really need I guess, as then I can't access is somehow by link.
if you are using the bigcommerce api, you can get the store information: https://developer.bigcommerce.com/api/stores/v2/store_information according the documentation
the api response give you:
stdClass Object
(
[id] => [your-store-identifier]
[domain] => [youstore-domain-name].mybigcommerce.com
[name] => test
[address] =>
[phone] =>
[admin_email] => test#domain.com
[order_email] => test#domain.com
[language] => en
[currency] => USD
[currency_symbol] => $
[decimal_separator] => .
[thousands_separator] => ,
[decimal_places] => 2
[currency_symbol_location] => left
[weight_units] => LBS
[dimension_units] => Inches
[dimension_decimal_places] => 2
[dimension_decimal_token] => .
[dimension_thousands_token] => ,
[plan_name] => Professional Application Developer Store
[logo] => Array
(
)
[is_price_entered_with_tax] =>
[active_comparison_modules] => Array
(
)
)

how to prevent to steal my video using amazon cloudfront

i have created distribution id.It has following property
Array (
[id] => E3VYXDXV1O9WXQ
[status] => Deployed
[time] => 1365430752
[domain] => d1fhielx2etku.cloudfront.net
[enabled] => 1
[origin] => avijit_bucket.s3.amazonaws.com
[originAccessIdentity] =>
[defaultRootObject] =>
[cnames] => Array
(
[mycustomvideo1.com] => mycustomvideo1.com
)
[trustedSigners] => Array
(
)
[comment] => New distribution created )
What will be next step.How do i access video

Create Recurring profiled failed in sandbox

I have working on SANDBOX. I am getting error :
[0] => Array
(
[L_ERRORCODE] => 11502
[L_SHORTMESSAGE] => Invalid Token
[L_LONGMESSAGE] => The token is invalid
[L_SEVERITYCODE] => Error
)
This is what i passing in CreateRecurringProfile :
[REQUESTDATA] => Array
(
[USER] => "API_USER"
[PWD] => "API_PASS"
[VERSION] => 74.0
[BUTTONSOURCE] => AngellEYE_PHPClass
[SIGNATURE] => "API_SING"
[METHOD] => CreateRecurringPaymentsProfile
[TOKEN] => EC-8F723718H3002730R
[SUBSCRIBERNAME] => Tester Testerson
[PROFILESTARTDATE] => 2012-09-06T00:00:00\Z
[DESC] => Item 1 Name
[AUTOBILLAMT] => 1
[BILLINGPERIOD] => Month
[BILLINGFREQUENCY] => 1
[TOTALBILLINGCYCLES] => 0
[AMT] => 10.00
[CURRENCYCODE] => USD
[EMAIL] => hide#address.com
[BUSINESS] => Testers, LLC
[FIRSTNAME] => Tester
[LASTNAME] => Testerson
)
NOTE: I have removed SANDBOX API Credential. To show here.
Please give me solution what is missing here or what is fault in my posting request.
Thanks for advance
Did you include L_BILLINGTYPE0=RecurringPayments in your SetExpressCheckout and DoExpressCheckoutPayment API calls?

Paypal Item Discounted to free, Shipping still to pay

I'm setting up Paypal on a site at the moment as an alternative payment method for customers. In general, it's working fine; I can put an order through and it goes through to Paypal's site, shows the correct information, and all is fine. When a user applies a discount to the order, things still work fine, no worries at all.
When a user applies a discount for the full order value (ie. order is for £20, they have a discount code for £20 off) I'm getting the error "Item total is invalid." back from Paypal. The cost being sent across is £0, and the shipping being sent across is £5.
First off, is there anything wrong with the fields I'm sending across, and if so, what's wrong? :) If you need any more info, feel free to ask.
Sample express checkout fields:
Array
(
[METHOD] => SetExpressCheckout
[RETURNURL] => /snip/
[CANCELURL] => /snip/
[NOTIFYURL] =>
[AMT] => 5.00
[DESC] =>
[CURRENCYCODE] => GBP
[MAXAMT] =>
[USERACTION] => commit
[INVNUM] =>
[ADDROVERRIDE] => 0
[SHIPTONAME] =>
[SHIPTOSTREET] =>
[SHIPTOSTREET2] =>
[SHIPTOCITY] =>
[SHIPTOSTATE] =>
[SHIPTOZIP] =>
[SHIPTOCOUNTRYCODE] =>
[LOCALECODE] => GB
[PAGESTYLE] =>
[HDRIMG] =>
[BUTTONSOURCE] => /snip/
[L_SHIPPINGOPTIONISDEFAULT0] => true
[L_SHIPPINGOPTIONNAME0] => Royal Mail Tracked Next Day Ref:/snip (int)/
[L_SHIPPINGOPTIONLABEL0] =>
[L_SHIPPINGOPTIONAMOUNT0] => 5.00
[L_SHIPPINGOPTIONISDEFAULT1] => false
[L_SHIPPINGOPTIONNAME1] => Interlink Express Next Day Delivery (Ord Ref:/snip (int)/
[L_SHIPPINGOPTIONLABEL1] =>
[L_SHIPPINGOPTIONAMOUNT1] => 7.00
[L_SHIPPINGOPTIONISDEFAULT2] => false
[L_SHIPPINGOPTIONNAME2] => Collect In Store Ref:/snip (int)/
[L_SHIPPINGOPTIONLABEL2] =>
[L_SHIPPINGOPTIONAMOUNT2] => 0.00
[L_NAME0] => /snip/
[L_NUMBER0] => /snip (item id)/
[L_DESC0] =>
[L_AMT0] => 8.33
[L_TAXAMT0] => 1.67
[L_QTY0] => 1
[L_NAME1] => /snip/
[L_NUMBER1] => /snip (item id)/
[L_DESC1] =>
[L_AMT1] => 8.33
[L_TAXAMT1] => 1.67
[L_QTY1] => 1
[L_AMT2] => -16.66
[L_TAXAMT2] => -3.34
[L_NAME2] => /snip/
[L_DESC2] => /snip/
[L_QTY2] => 1
[ALLOWNOTE] => 1
[BUYEREMAILOPTINENABLE] => 1
[CALLBACK] => /snip/
[CALLBACKURL] => /snip/
[CALLBACKTIMEOUT] => 6
[REQCONFIRMSHIPPING] => 0
[SHIPPINGAMT] => 5.00
[ITEMAMT] => 0.00
[TAXAMT] => 0.00
)
You can't send an empty or zero amount to PayPal. $0.01 is the lowest you can go.
You can try and work around this by taking a cent from the shipping and adding it to the total or swap the shipping and item charges if the item charge is zero.

Zend Select with self join overwriting fields

Posts and comments are stored in the same table. So to get each post and its comments we do this:
$posts = $this->select()->setIntegrityCheck(false)
->from(array('post' => 'Posts'), array('*'))
->where('post.idGroup = ' . $idGroup)
->where('post.idTopic IS NULL')
->order('post.date DESC')
->limit($resultsPerPage, $resultsPerPage * ($page - 1))
->joinLeft(array('user' => 'Users'), 'post.idUser = user.idUser',
array('idUser', 'fname', 'lname', 'profileUrl', 'photoUrl'))
->joinLeft(array('comment' => 'Posts'), 'comment.idTopic = post.idPost')
->query()->fetchAll();
The problem is that the resulting array is flat and the comment data overwrites the post data, this is an example of what is returned:
[1] => Array
(
[idPost] => 13
[idTopic] => 11
[idGroup] => 1
[idUser] => 84
[postContent] => Hello my name is Mud.
[postUrl] => 13/hello-my-name-is-mud
[postVotes] =>
[postScore] =>
[date] => 2009-07-21 16:39:09
[fname] => John
[lname] => Doe
[profileUrl] => john-doe
[photoUrl] => uploads/userprofiles/0/84/pic84_14
)
What we would like the result to be is something more like this:
[1] => array(
[post] => array(
[0] => array(
idPost => 12,
postContent => This is a post...,
idGroup => 1
...
)
),
[user] => array(
[0] => array(
userName => JohnDoe
...
)
),
[comments] => array(
[0] => array(
idPost => 15,
postContent => This is a comment...,
idGroup => 1
...
),
[1] => array(
idPost => 17,
postContent => This is another comment...,
idGroup => 1
...
)
)
)
Any hints to other solutions is also very welcome.
Thanks.
If you alias all the columns in the second join to posts (like idPost as child_idPost... etc), you'll get many rows that are the parent row with the columns of the second row. Thats about the closest you'll get. You can then grab the parent data from the first row, and then loop through the subsequent rows to get your one-to-many data.
Otherwise, just do two queries, one for the parent, one for the children. It may be faster than creating that large result table anyway.
Zend does not make your preferred form easy, but it might be possible. Note, however, that you are asking the database server to do far more work than you actually want, because the post and user information are duplicated for each comment. Justin is correct that a second query is easier and probably faster. However, I can provide some pointers toward a solution.
To start, consider what you would get by using the Zend_Db::FETCH_NUM fetch mode:
Array(
[0] => Array(
[0] => 12
[1] =>
[2] => 1
[3] => 84
[4] => This is a post...,
[5] => 12/this-is-a-post
[6] =>
[7] =>
[8] => 2009-07-21 16:39:09
[9] => 84
[10] => John
[11] => Doe
[12] => john-doe
[13] => uploads/userprofiles/0/84/pic84_14
[14] => 15
[15] => 12
[16] => 1
[17] => 79
[18] => This is a comment...,
[19] =>
[20] =>
[21] =>
[22] => 2009-07-21 17:40:10
),
[1] => Array(
[0] => 12
[1] =>
[2] => 1
[3] => 84
[4] => This is a post...,
[5] => 12/this-is-a-post
[6] =>
[7] =>
[8] => 2009-07-21 16:39:09
[9] => 84
[10] => John
[11] => Doe
[12] => john-doe
[13] => uploads/userprofiles/0/84/pic84_14
[14] => 17
[15] => 12
[16] => 1
[17] => 127
[18] => This is another comment...,
[19] =>
[20] =>
[21] =>
[22] => 2009-07-20 10:31:26
)
)
Then somehow you have to come up with the mapping of column numbers to table and column names:
Array(
[0] => post.idPost
[1] => post.idTopic
[2] => post.idGroup
[3] => post.idUser
[4] => post.postContent
[5] => post.postUrl
[6] => post.postVotes
[7] => post.postScore
[8] => post.date
[9] => user.idUser
[10] => user.fname
[11] => user.lname
[12] => user.profileUrl
[13] => user.photoUrl
[14] => comment.idPost
[15] => comment.idTopic
[16] => comment.idGroup
[17] => comment.idUser
[18] => comment.postContent
[19] => comment.postUrl
[20] => comment.postVotes
[21] => comment.postScore
[22] => comment.date
)
This is the part where it gets tricky, because the table part of that is strongly specific to the database interface, and not always possible. Because it is tied to the result set, the adapter will also be the best place to obtain it; that means hacking Zend classes, possibly by providing your own adapter class. Depending on your database, the information might come from:
PDO: PDOStatement->getColumnMeta
Mysqli: mysqli_fetch_field_direct
Other adapters might not have a way to obtain the table name, unfortunately.
Yeah we've had the same issue, just finished blogging about it: http://www.kintek.com.au/blog/zend-db-and-joins/
You need to name each field uniquely, it's a known bug in Zend: http://framework.zend.com/issues/browse/ZF-6421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel