Author Topic: Add to cart hook without using customfield plugins  (Read 1243 times)

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Add to cart hook without using customfield plugins
« on: November 26, 2012, 12:39:15 pm »
Hello, I am using VM 2.0.14.

I am trying to write a plugin and would like a suggestion on which hook I should use.

I need to set an action on "add to cart". I tried with a "VMCustom" plugin, but it seems to me that this is mainly related to custom fields for specific products. I don't want to add a custom field to all my products to be able to trigger my action.
Is there any better hook that I am missing?

Thank you for your time.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

sandomatyas

  • Jr. Member
  • **
  • Posts: 282
Re: Add to cart hook without using customfield plugins
« Reply #1 on: March 23, 2016, 11:24:40 am »
Great question.
Is there a plugin method which is triggered when I add a product to the cart (or somwhere around getCart() function)?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4048
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Add to cart hook without using customfield plugins
« Reply #2 on: March 24, 2016, 00:23:37 am »
You can use a payment or shipment plugin. This get triggered too.
So it depend your need, but you can use 'plgVmOnAddToCartFilter' in VM 3 if a customfield exist or a Joomla plugin too for a more general way to check add to cart.

dmb

  • Jr. Member
  • **
  • Posts: 81
  • A beginner
Re: Add to cart hook without using customfield plugins
« Reply #3 on: April 28, 2016, 10:40:12 am »
J3.5.1
VM3.0.16

Hi,

Where's a good place to go to find out more about how to do this ? I need to reprice my cart when a particular product is added to it or taken out (buying membership product gives you discount on all the other ones). I'm piecing the puzzle together but it's hard to know where to start.

Any tips gratefully received !

David

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4048
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Add to cart hook without using customfield plugins
« Reply #4 on: April 28, 2016, 13:11:01 pm »
J3.5.1
VM3.0.16

Hi,

Where's a good place to go to find out more about how to do this ? I need to reprice my cart when a particular product is added to it or taken out (buying membership product gives you discount on all the other ones). I'm piecing the puzzle together but it's hard to know where to start.

Any tips gratefully received !

David
Awo coupon PRO can do many of this hooks.