onBeforeCartSave

  • Posts: 42
  • Thank you received: 3
2 years 4 months ago #343398

-- url of the page with the problem -- : eduquay.satumalaysiahosting.com/bundle-p...8-buku-buku-lembaran

I'm trying to save all bundled products with one click hence I developed a plugin implementing onBeforeCartSave.

But I'm confused about the function body for example, what should I write in the plug-in function.


function onBeforeCartSave(&$element,&$do)
{
// Code
}

I have already gone through the documentation but still have no idea. I hope can get some examples here.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 4 months ago #343400

Hi,

What do you mean by "save all bundled products with one click" ?
The onBeforeCartSave event is triggered when the cart of the user is modified (when a product is added, removed, updated, etc).

Are you saying that when a product is added to the cart, you want to also add to it the bundled products of that product to the cart ?
You'll find the products in $element->products
So you'll first want to loop on the products in there, and load the bundled products of these products with a MySQL query on the hikashop_product_related table. You'll then want to add them to $element->products.

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

  • Posts: 42
  • Thank you received: 3
2 years 4 months ago #343426

Hi,

URL: eduquay.satumalaysiahosting.com/bundle-p...8-buku-buku-lembaran

I have created an 'Add All' button to add all the listing products to the cart, the method I'm using now is triggered the 'href' by JQuery, but it seems too heavy for the server.

So I'm now trying to develop a plugin to perform this action.

Attachments:
The following user(s) said Thank You: Philip

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
2 years 4 months ago #343432

Hello,

This message just to inform you that we are in reduced numbers (holiday period), and that consequently our follow-up will be slower than usual.
Hope this is not a problem for you

Regards

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

Time to create page: 0.039 seconds
Powered by Kunena Forum