- Posts: 10
- Thank you received: 1
Adding product issue while using hikashop api
10 years 6 months ago - 10 years 6 months ago #231906
by vahid.vdn
Adding product issue while using hikashop api was created by vahid.vdn
-- HikaShop version -- : 2.6.1
-- Error-message(debug-mod must be tuned on) -- : 500 server error
Hi there.
I'm going to add a single product to hikashop by it's api for custom php codes. I load joomla framework and hikashop helper.php fine. I even can load a single product ang get it's fields.
Now I want to add a product, and when I write $product->save($product); it gives me 500 server error. My codes:
$product = hikashop_get('class.product');
$product->product_name = "vahid product test";
$product->product_quantity = 5;
$product->product_published = 1;
//$product->product_tax_id = 11;
$product->product_weight = 1;
$product->product_weight_unit = "kg";
//$product->product_min_per_order = $min_order;
$product->product_type = "main";
$product->product_access = "all";
/*$product->product_manufacturer_id = $id_merek;
$product->grup = $grup;
$product->tipe = $tipe;
$product->unit = $unit;*/
$product->prices = array(15000);
$product->categories = array(17);
$product->save($product);
-- Error-message(debug-mod must be tuned on) -- : 500 server error
Hi there.
I'm going to add a single product to hikashop by it's api for custom php codes. I load joomla framework and hikashop helper.php fine. I even can load a single product ang get it's fields.
Now I want to add a product, and when I write $product->save($product); it gives me 500 server error. My codes:
$product = hikashop_get('class.product');
$product->product_name = "vahid product test";
$product->product_quantity = 5;
$product->product_published = 1;
//$product->product_tax_id = 11;
$product->product_weight = 1;
$product->product_weight_unit = "kg";
//$product->product_min_per_order = $min_order;
$product->product_type = "main";
$product->product_access = "all";
/*$product->product_manufacturer_id = $id_merek;
$product->grup = $grup;
$product->tipe = $tipe;
$product->unit = $unit;*/
$product->prices = array(15000);
$product->categories = array(17);
$product->save($product);
Last edit: 10 years 6 months ago by vahid.vdn.
Please Log in or Create an account to join the conversation.
10 years 6 months ago #231915
by nicolas
Replied by nicolas on topic Adding product issue while using hikashop api
Your code is wrong.
It should be:
It should be:
Code:
$productClass = hikashop_get('class.product');
$product = new stdClass();
$product->product_name = "vahid product test";
$product->product_quantity = 5;
$product->product_published = 1;
//$product->product_tax_id = 11;
$product->product_weight = 1;
$product->product_weight_unit = "kg";
//$product->product_min_per_order = $min_order;
$product->product_type = "main";
$product->product_access = "all";
/*$product->product_manufacturer_id = $id_merek;
$product->grup = $grup;
$product->tipe = $tipe;
$product->unit = $unit;*/
$product->prices = array(15000);
$product->categories = array(17);
$productClass->save($product);
Please Log in or Create an account to join the conversation.
Time to create page: 0.174 seconds