Using the product and cart API

  • Posts: 3
  • Thank you received: 0
10 years 2 weeks ago #179127

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3

Hi,

I'm new to using Hikashop and I'm developing a module for Joomla that needs to create either a product or a product variant that is created by the customer from my module. I'm currently using the Starter version for developing but the person I'm developing for will be using the Business version.

From the developer API document pages I can see how to use all the triggers but I'm not sure how I would go about creating a product and adding it to the cart. The customer may want to build more than 1 item in my module before checkout so I will need to add these items without leaving the current page.

The product will be build by sections so I will be creating a product code from a combination of the parts. These parts can exist in the product table if that helps but they must never appear as single items in any views or receipts.

An example product would be creating a bike where you can choose different frames, seats, handle bars and wheels and the end product for checkout would only list 'custom bike' with a total price of the components and build costs.

Is there a detailed API documentation about how to handle this or maybe some examples that create a product and add it to the cart?

Thanks for your help.

Last edit: 10 years 2 weeks ago by venomDev.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 week ago #179143

Hi,

The triggers are events, it is a way to integrate with HikaShop but triggers are not the way to add content in HikaShop.
To create content in HikaShop you have to use the HikaShop classes and call the "save" function, giving them the object data that you want to store in the database.

It is something that I talk about with "ruslan_zasukhin" in this thread ; but more for orders than products (even if the process is the same).
www.hikashop.com/forum/integrations/8716...ch-soap-service.html

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 3
  • Thank you received: 0
10 years 1 week ago #179359

Hi,

I've been looking through the classes php files and have a better idea about products and categories now. I've added the parts as products under a brand category. I'm not sure I'm using these in the most efficient way but what I'm currently doing is using

$brands = $category->getList('manufacturer', 0, false);

Then scan the array for the brand I am looking for. I then use
        // $id is set from the previous scan
        $tree = $product->getTreeList($id, 3);
	foreach($tree[1] as $tr){
		$product->getProducts($tr->product_id);
	}

To find all the individual parts that will be used to create the item. From here I will build the item using my Joomla module and later save it back as a product variant (I haven't written this code yet).

Do these classes have API documentation available somewhere?

If I know the manufacturer's name is it possible to have HikaShop search for a string in the category table to return 1 record with the category_id that I need?

Atm it seems necessary to know all the Ids which I need to manually scan for.

Thanks for your help.

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

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
10 years 1 week ago #179377

Hi,

1. We don't have a documentation for all the functions of the HikaShop classes.

2. We don't have a function to search for a string in the category table. You can do that with a MySQL query.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum