- Posts: 32
- Thank you received: 2
CartClass add product in empty cart nothing happen
- PortobelloDigital
-
Topic Author
- Offline
Less
More
10 years 11 months ago - 10 years 11 months ago #218681
by PortobelloDigital
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.6.x
Hi,
I want to add product in cart via hikashopCartClass->update (like: www.hikashop.com/support/support/documen...umentation.html#code ).
If cart got products (1 or more) this work, if i delete all products then try again it work but on a fresh session nothing happen.
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.6.x
Hi,
I want to add product in cart via hikashopCartClass->update (like: www.hikashop.com/support/support/documen...umentation.html#code ).
If cart got products (1 or more) this work, if i delete all products then try again it work but on a fresh session nothing happen.
Code:
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,'/').'/components/com_hikashop/helpers/helper.php')){ return false; }
$productId = 1; // this product exist in hikashop
$cartClass = hikashop_get('class.cart');
$datas = array(
'item' => array('spec' => 'somevalue')
);
JRequest::setVar('data',$datas);
$check = $cartClass->update($productId,1,1,'product',true,true);
Last edit: 10 years 11 months ago by PortobelloDigital.
Please Log in or Create an account to join the conversation.
- PortobelloDigital
-
Topic Author
- Offline
Less
More
- Posts: 32
- Thank you received: 2
10 years 11 months ago #218824
by PortobelloDigital
Replied by PortobelloDigital on topic CartClass add product in empty cart nothing happen
After some further investigation, i noticed on a fresh session, when using a plgHikashop, calling
in
function, prevent adding product.
Using
fix this.
Topic can now be closed.
Code:
$cartClass->get($cart->cart_id)
Code:
onBeforeCartUpdate
Using
Code:
$cartClass->get($cart->cart_id,true)
Topic can now be closed.
Please Log in or Create an account to join the conversation.
Time to create page: 0.160 seconds