I have been working on a bug now that has been plaguing me for ages and it is really obscure and difficult to get to the bottom of.
The bug only affects iOS devices (iPhone/iPad)
It won't always affect a device, it seems to be random
Customers who have placed several orders fine may suddenly experience it, then when placing another order minutes later not experience it
We have seen it happen in both very old devices and newer versions of iOS
It only affects users using Safari that we have seen
Theories we have tested:
Something to do with mobile data/switching between cell towers when roaming causes the session to become corrupt. We were unable to reproduce this and customers experiencing it say it has happened while at home on WiFi
When switching between HTTP/HTTPS the session is becoming void, we made the entire site secure and it still happened
Poor code in our cart somewhere, we operate multiple brands and some are using different carts. A similar thing happens in all of them
Server misconfiguration, tried multiple servers with 4 different hosts. They configured the server in 2 instances with the same result.
The payment gateway isn't working correctly (we used to use a HPP & PayPal solution), we switched to an API solution with the same result
Somehow misconfigured product, can't be the case as the same product works fine in almost all cases, except the odd iOS ones
Below I have included a sample of what the array should look like storing the cart, and what it looks like on a corrupt iOS cart
Correct Cart
$_SESSION['cart'] = array(
'items' = array (0 => array(
'product_name' => 'Shirt',
'product_price' => '20.00',
'product_sku' => '801245',
'vat_rate' => '20.0000',
'attributes' => array(
'size' => array('value' => 'large', 'cost' => '+5'),
'qty' => array('value' => 1, 'cost' => '+0'),
'colour' => array('value' => 'blue', 'cost' => '+0'),
),
'delivery_info' => array(
'name' => 'Mr A. Tester',
'line1' => 'Street',
'line2' => 'Off another street',
'company' => 'ACME Ent.',
'postcode' => 'AA1 0AA',
'county' => 'London',
'country' => 'United Kingdom',
'date' => '2015-12-01',
),
)
),
'totals' = array (
'item' => '20.00',
'extras' => '5.00',
'delivery' => '3.00',
'blended_vat' => '20.0000',
'to_pay' => '28.00',
),
'cart_id' = 'fc5e038d38a57032085441e7fe7010b0',
'customer_id' = '102145',
'order_status' = 'Pending',
'paid' = false,
)
Corrupt iOS Cart
$_SESSION['cart'] = array(
'items' = array (
'attributes' => array(
'size' => array('value' => 'large', 'cost' => '+5'),
'qty' => array('value' => 1, 'cost' => '+0'),
'colour' => array('value' => 'blue', 'cost' => '+0'),
),
'delivery_info' => array(
'name' => 'Mr A. Tester',
'line1' => 'Street',
'line2' => 'Off another street',
'company' => 'ACME Ent.',
'postcode' => 'AA1 0AA',
'county' => 'London',
'country' => 'United Kingdom',
'date' => '2015-12-01',
),
)
),
0 => array(
'product_name' => 'Shirt',
'product_price' => '20.00',
'product_sku' => '801245',
'vat_rate' => '20.0000',
'totals' = array (
'item' => '20.00',
'extras' => '5.00',
'delivery' => '3.00',
'blended_vat' => '20.0000',
'to_pay' => '28.00',
),
'cart_id' = 'fc5e038d38a57032085441e7fe7010b0',
'customer_id' = '102145',
'order_status' = 'Pending',
'paid' = false,
)
I would love to hear anyone's thoughts on this and any possible suggestions. As I say the cart works fine with every OS/Browser combination. It only randomly seems to affect iPhones/iPads, and could work fine on the same device several times, then not work, then work again.
It seems random as to when it won't work.
Related
Question might be difficult to answer but here it goes:-
See I have an market order book in array like this:-
$str = array(
array(
'amount' => 1.5,
'price' => 10,
'user' => 'test',
'filled' => 0,
'status' => 'active',
),
array(
'amount' => 2.5,
'price' => 10,
'user' => 'test1',
'filled' => 0,
'status' => 'active',
),
array(
'amount' => 5,
'price' =>10,
'user' => 'test2',
'filled' => 0,
'status' => 'active',
),
array(
'amount' => 10,
'price' => 10,
'user' => 'test3',
'filled' => 0,
'status' => 'active',
)
);
Here the above arrays shows the name of user selling the amount of a thing and the price per thing. Status is active as nothing is still sold to anyone(filled is 0). Let's say a user named test4 comes into the picture and wants to buy 6 things at price'10'. How do I make so that the first three orders get dynamically filled and also from 'active' status to 'done' or 'partially filled'.
Please help :)
I have an existing implementation of this class processing subscriptions by credit card but I now need to add the facility to accept payment by eCheck but I am unsure of how to change this portion of the code:
'payment' => array(
'creditCard' => array(
'cardNumber' => '4111111111111111',
'expirationDate' => '2016-08'
)
),
I have come up with the following from referencing the AIM guide pdf and AIM guide XML pdf
'payment' => array(
'bankAccount' => array( // x_method equivalent ?
'routingNumber' => '', // x_bank_aba_code equivalent ?
'accountNumber' => '', // x_bank_acct_num equivalent ?
'nameOnAccount' => '', // x_bank_acct_name equivalent ?
'bankName' => '', // x_bank_name equivalent ?
'echeckType' => 'WEB' // x_echeck_type equivalent
/*
x_bank_acct_type has no equivalent ?
*/
)
),
but there appears to be some discrepancies between the required fields?
Any pointers before I start on this would be greatly appreciated.
Looking at Authorize.Net's documentation this should work:
'payment' => array(
'bankAccount' => array(
'accountType' => '', // 'checking'
'routingNumber' => '',
'accountNumber' => '',
'nameOnAccount' => ''
)
),
Following on from John's answer this is the complete code I used to solve this for anyone finding this through a google search:
$xml->ARBCreateSubscriptionRequest(array(
'subscription' => array(
'name' => 'SubscriptionName',
'paymentSchedule' => array(
'interval' => array(
'length' => '1',
'unit' => 'months'
),
'startDate' => date('Y-m-d', time()), // Format: YYYY-MM-DD
'totalOccurrences' => '9999' // To submit a subscription with no end date (an ongoing subscription), this field must be submitted with a value of 9999
),
'amount' => $eCart1->GrandTotal(), // total monthly subscription
'payment' => array(
'bankAccount' => array(
'accountType' => ((isset($_POST["accountType"]))?$_POST["accountType"]:""), // options available are checking or businessChecking in this instance
'routingNumber' => ((isset($_POST["routingNumber"]))?$_POST["routingNumber"]:""),
'accountNumber' => ((isset($_POST["accountNumber"]))?$_POST["accountNumber"]:""),
'nameOnAccount' => ((isset($_POST["nameOnAccount"]))?$_POST["nameOnAccount"]:""),
'echeckType' => ((isset($_POST["echeckType"]))?$_POST["echeckType"]:"") // if businessChecking is chosen then 'CCD' else 'WEB'
)
),
'customer' => array(
'id' => "'".$_SESSION['clientID']."'",
'email' => "'".((isset($_POST["email"]))?$_POST["email"]:"")."'"
),
'billTo' => array(
'firstName' => "'".((isset($_POST["firstname"]))?$_POST["firstname"]:"")."'",
'lastName' => "'".((isset($_POST["lastname"]))?$_POST["lastname"]:"")."'",
'company' => "'".((isset($_POST["company"]))?$_POST["company"]:"")."'",
'address' => "'".((isset($_POST["street1"]))?$_POST["street1"]:"")."'",
'city' => "'".((isset($_POST["city"]))?$_POST["city"]:"")."'",
'state' => "'".((isset($_POST["state_province"]))?$_POST["state_province"]:"")."'",
'zip' => "'".((isset($_POST["postcode"]))?$_POST["postcode"]:"")."'"
)
)
));
I have problem with bigcommerce API. When I am updating a product, or deleting all images, it works fine. But, together the methods are taking long to load and doing nothing. This is my code:
Bigcommerce_Api::configure(array(
'store_url' => $storeURL,
'username' => $APIuser,
'api_key' => $APIkey
));
Bigcommerce_Api::setCipher('RC4-SHA');
Bigcommerce_Api::verifyPeer(false);
$fields = array(
'name' => $data['title'],
'type' => 'physical',
'description' => $data['description'],
'price' => $data['price'],
'categories' => array(($catCreated ? $catID->id : $catObject[0]->fields->id)),
'availability' => 'available',
'weight' => '0.5',
'sku' => $data['sku'],
'search_keywords' => $data['tags']
);
Bigcommerce_api::updateProduct($id, $fields);
Bigcommerce_api::deleteProductImages($id);
Where is the problem? Why I can't do 2 methods one after another?
documentation: https://github.com/bigcommerce/bigcommerce-api-php
I managed to make news (tx_news) work realurl under the default language. Then I wanted to localize the news, so I created transaltions for them. However when I access the list view for a non-default language, it fails with
Request parameters could not be validated (&cHash comparison failed)
The failing link does not contain cHash, it looks like this
http://host.com/mysite/en/about-us/
What could be the cause and how to fix it? Here is the realURL setup
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'enableCHashCache' => true,
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'appendMissingSlash' => 'ifNotFile,redirect',
//'adminJumpToBackend' => true,
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/mysite/',
),
'pagePath' =>
array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'rootpage_id' => '1',
'firstHitPathCache'=> '1',
),
'preVars' =>
array (
0 =>
array (
'GETvar' => 'L',
'valueMap' =>
array (
'cs' => '1',
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
'19' => array(
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' =>
'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'enable404forInvalidAlias' => '1',
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
),
),
),
),
),
);
With this error I had fight a lot.
Go to Typo3 Install Tool => All configuration and change the value 1 => 0 for this attribute.
[FE] [pageNotFoundOnCHashError] = 0
I hope this gona solve the problem !!!
I seem to have fixed it by emptying the tx_realurl_chashcache in the database.
I had to disable caching for the page. On my site it seems the "no_cache" parameter is confusing the chash calculation. This way i can keep the - i think important - security setting [FE][pageNotFoundOnCHashError] = 0
In Typo3 8.x version:
click the "Speaking Urls" module in the backend and than do "Flush all entries"
Now when you browse the frontend those entries would get re-created. And every thing should work fine.
Basically here we are deleting all page path entries for all pages so that they get created again.
Also you may delete the entries for the selected page by selecting the option "Delete all entries for this page"
not sure if this is the best way to do what I need but this is my issue. In my edit function view I recreate a forms fields based on what's in $this->data->expense but I need the array to be in a certain order or the fields get generated in the wrong order. This is the array I have:
'Expense' => array(
(int) 0 => array(
'id' => '98',
'date' => '2012-08-23',
'sitename' => '123',
'detail' => 'Breakfast',
'amount' => '100.00',
'miles' => null,
'total' => '100.00',
'expense_claim_id' => '63',
'created' => '2012-08-23 09:08:52',
'modified' => '2012-08-23 09:08:52',
'ExpenseClaim' => array(
'id' => '63',
'user_id' => '3',
'claim_status_id' => '1',
'created' => '2012-08-23 09:08:52',
'modified' => '2012-08-23 10:14:10',
'approved' => false,
'approved_by' => '0',
'date_submitted' => '2012-08-23 09:08:52'
),
'ExpenseCode' => array(
(int) 0 => array(
'id' => '1',
'name' => 'Plane fare',
'code' => '1',
'created' => '2012-07-31 09:52:02',
'modified' => '2012-07-31 09:53:57'
)
)
),
This is how I need it to be ordered (ExpenseCode) appears higher up:
'Expense' => array(
(int) 0 => array(
'id' => '98',
'date' => '2012-08-23',
'sitename' => '123',
'detail' => 'Breakfast',
'ExpenseCode' => array(
(int) 0 => array(
'id' => '1',
'name' => 'Plane fare',
'code' => '1',
'created' => '2012-07-31 09:52:02',
'modified' => '2012-07-31 09:53:57'
)
),
'amount' => '100.00',
'miles' => null,
'total' => '100.00',
'expense_claim_id' => '63',
'created' => '2012-08-23 09:08:52',
'modified' => '2012-08-23 09:08:52',
'ExpenseClaim' => array(
'id' => '63',
'user_id' => '3',
'claim_status_id' => '1',
'created' => '2012-08-23 09:08:52',
'modified' => '2012-08-23 10:14:10',
'approved' => false,
'approved_by' => '0',
'date_submitted' => '2012-08-23 09:08:52'
)
),
How can I achieve this and will changing the structure of it affect cake when I post?
As far as I know, there is no built-in function on CakePHP to custom sort an array. I guess you will have to do this with pure PHP. https://stackoverflow.com/search?q=custom+sort+array+php
Unless you must have the fields created dynamically, I suggest you to add each field yourself.
will changing the structure of it affect cake when I post?
No, if you simply put the fields in a different order this won't affect CakePHP. The data sent via POST will be in array $this->data['Expense']. When saving the data with $this->model->save(), the order does not matter.
This makes no sense. If the order of the data in an associative array is causing your HTML fields/form inputs..whatever to be in the wrong order, you're doing it wrong.
Try using the keys instead of just looping through in order. Or read more about associative arrays - there are a lot of fun / easy things to do to use & manipulate their data... but again to reiterate, there is NO need to return the data in a specific order.
Edit:
You could always create an array of keys and repeat through those. Might be a cleaner way of managing the order.