Skip to main content

CartClass add product in empty cart nothing happen

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.
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.

More
10 years 11 months ago #218824 by PortobelloDigital
After some further investigation, i noticed on a fresh session, when using a plgHikashop, calling
Code:
$cartClass->get($cart->cart_id)
in
Code:
onBeforeCartUpdate
function, prevent adding product.
Using
Code:
$cartClass->get($cart->cart_id,true)
fix this.

Topic can now be closed.

Please Log in or Create an account to join the conversation.

Time to create page: 0.160 seconds
Powered by Kunena Forum