Hello,
How do I override certain functions in e-commerce module without modifying the core files?
To be specific, I want to override the "AllowPurchase" and "addToCart" functions in Product.php
Thanks,
Jatinder Singh Thind
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.
Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba
Hello,
How do I override certain functions in e-commerce module without modifying the core files?
To be specific, I want to override the "AllowPurchase" and "addToCart" functions in Product.php
Thanks,
Jatinder Singh Thind
Hi Jatinder,
Did you find a way to solve this?
Regards,
Rodolfo
Hi guys,
AllowPurcahse on Product class has been deprecated, and replaced with canPurchase a while back.
You should be able to override / modify this function by creating an extension of Product that implements the canPurchase function. See silverstripe documentation on how to create extensions.
regards,
Jeremy