8 Apr 2010, 11:45 PM
New Zenner
- Join Date:
- Nov 2009
- Posts:
- 6
- Plugin Contributions:
- 0
what causes zc timeout on curl post back to itself with this custom add to cart code?
Hi all!
I'm trying to modify zen cart and add custom made products into a user's cart. Here's my test code:
$data = array('id[1]' => '101896', 'id[2]' => '101893', 'cart_quantity' => '1', 'products_id' => '101893');
$url = 'http://localhost/zencart/index.php?main_page=product_info&products_id=101893&action=add_product';
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($handle);
Please try it with your own product and its attributes (or remove the id[x] elements from the $data array if you don't have attributes) to see the outcome. Oh and change the url to match your zen cart location.
Basically, it will post an add to cart request and show the shopping cart with the new item added to it.
My problem is that checking out from that page will result in a time out. Why do you think this is?
Happy to be Zenning today.