CartClass add product in empty cart nothing happen

  • Posts: 32
  • Thank you received: 2
9 years 3 weeks ago #218681

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

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: 9 years 3 weeks ago by PortobelloDigital.

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

  • Posts: 32
  • Thank you received: 2
9 years 3 weeks ago #218824

After some further investigation, i noticed on a fresh session, when using a plgHikashop, calling

$cartClass->get($cart->cart_id)
in
onBeforeCartUpdate
function, prevent adding product.
Using
$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.052 seconds
Powered by Kunena Forum