-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.29
-- Browser(s) name and version -- : Chrome 46
Hello,
I am trying to create automatically a cart.
I have a form in which visitors enter information, including name and address. They also choose in this form their status. When the form is submitted, I do the following:
- according to the status, I add a product to the cart; this is actually working well.
- I try to initialize the address with the information provided in the form; this is not working.
Here is the PHP code I am using after the form submission:
<?php
if(!@include_once(rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php'))
{
return false;
}
$Produit = $_GET["zkprod"];
$Reference = $_GET["zkref"];
$Nom = $_GET["zknom"];
$Prenom = $_GET["zkpre"];
$CP = $_GET["zkcp"];
$cartClass = hikashop_get('class.cart');
$cartClass->update($Produit, 1);
$addrClass = $cartClass->loadAddress();
$addrClass->address_title = $Reference;
$addrClass->address_first_name = $Prenom;
$addrClass->address_last_name = $Nom;
$addrClass->address_post_code = $CP;
?>
All the variables contain correct information at this point and the correct product is added to the cart. However, I cannot manage to initialize the address : when I proceed to checkout, the order is created with the correct product but the address information is empty.
I understood that only the Business edition of HikaShop can manage guest checkout. Is the problem occuring because I am currently using the starter edition? Will my PHP code run correctly when I purchase the Business edition?
I don't want to use the custom fields from HikaShop because the form I need is not only used for ordering online: I still want to use my form as it is.
And do you have more PHP code samples available? I only saw a few in the developer documentation...
Thank you very much for your answers.