- Posts: 2
- Thank you received: 0
fails to create new cart for a custom product
13 years 6 months ago #92473
by Stine
fails to create new cart for a custom product was created by Stine
Hello,
my goal is to create an application where the user should be able to assemble the product with ingredients of his/her choice.
I'm currently facing a Problem. How can I create a new cart for my session from my php-file. I can create other database entries but it fails to create a cart.
$id= session_id();
$cart = '\'cart\'';
$query = "INSERT INTO jxe3i_hikashop_cart (user_id,session_id,cart_modified,cart_type) VALUES (0, '". $id."',$timestamp,$cart)";
mysql_query($query);
When I write this sql command direktly in phpmyadmin it works.
The code samples from the developer documentation also failed in my php file.
www.hikashop.com/en/support/documentatio...umentation.html#code
Could you please help me.
Thank you
my goal is to create an application where the user should be able to assemble the product with ingredients of his/her choice.
I'm currently facing a Problem. How can I create a new cart for my session from my php-file. I can create other database entries but it fails to create a cart.
$id= session_id();
$cart = '\'cart\'';
$query = "INSERT INTO jxe3i_hikashop_cart (user_id,session_id,cart_modified,cart_type) VALUES (0, '". $id."',$timestamp,$cart)";
mysql_query($query);
When I write this sql command direktly in phpmyadmin it works.
The code samples from the developer documentation also failed in my php file.
www.hikashop.com/en/support/documentatio...umentation.html#code
Could you please help me.
Thank you
Please Log in or Create an account to join the conversation.
13 years 6 months ago - 13 years 6 months ago #92541
by Xavier
Replied by Xavier on topic fails to create new cart for a custom product
Hi,
I tried the code:
On my end and it's working fine, when displaying the page where I placed the code, a product is added to the cart.
Are you sure that you have set a valid product id, and a valid quantity ?
PS: a cart is created only when there is products inside, else it's not saved.
I tried the code:
Code:
$cartClass = hikashop_get('class.cart');
$cartClass->update($product_id,$quantity);
Are you sure that you have set a valid product id, and a valid quantity ?
PS: a cart is created only when there is products inside, else it's not saved.
Last edit: 13 years 6 months ago by Xavier.
Please Log in or Create an account to join the conversation.
13 years 6 months ago - 13 years 6 months ago #92574
by Stine
Replied by Stine on topic fails to create new cart for a custom product
Hi,
problem solved.
Your PS helped. :laugh:
Thank you
problem solved.
Your PS helped. :laugh:
Thank you
Last edit: 13 years 6 months ago by Stine.
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds