X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   modifying promotional coupons to accept multiple products instead of just one (https://forum.x-cart.com/showthread.php?t=75774)

madhatter717 11-08-2017 09:03 AM

modifying promotional coupons to accept multiple products instead of just one
 
hello,

I would like to modify our promotional coupons to accept multiple products, in the "product" input field at the bottom of the coupons creation page.

What files should I be looking at to make the modifications I want? Since it is dealing with the admin side I cannot use webmaster mode to identify the correct pages. I did use the Webmaster Kit module and was pointed to the admin .tpl's only. I did find a reference to Class\XLite\Modules\CDev\Coupons\View\Model\Coupon .php, but I am unsure what the name of the function I am looking for is. Any help locating the particular .php file and the name of the function I should be looking for would be greatly appreciated.

We have a very diverse set of products within our catalog, with a very aggressive marketing campaign, while I can assign multiple products through either the Product Class form field or the Product Category form field, there are occasions where our marketing dept, offers promotions for two kinds of product within the same Product/Category class but NOT to the rest of that Product/Category Class ( an example, one of our product lines is Brochures, Brochures have their own product class for the various kinds of brochures we offer within the Brochure Category. On occasion we offer a promotional discount to buy 2 brochures of the same class within the Brochure category, but NOT to all of the brochures inside that Brochure Product class/Category).

Currently to make these promotions work I have to add an additional temporary Product class which has the 2 items we want to specifically target. While not overly difficult, it is tedious and less than elegant.

The Product form field at the bottom of the Coupons page is the ideal solution for this particular problem, because it can apply the promotional discount to a specific product. The problem is it only allows for a single product to be used, I would like to change that.

Any help or guidance with this would be greatly appreciated.

Thank you

qualiteam 11-13-2017 07:58 AM

Re: modifying promotional coupons to accept multiple products instead of just one
 
It is possible to customise X-Cart this way, however this requires creating a new module and hacking multiple classes and templates from it.

First of all, you should link the coupon model (\XLite\Module\CDev\Coupons\Model\Coupon) with the product model (\XLite\Model\Product) through a two-side @ManyToMany relation.

Then you should edit classes that displays the Edit Coupon form and add a widget that allows you to select products for a coupon.

Plus you should edit classes that implement the coupon discount logic and make it check for the linked products.

If you are unsure how to code the above, I believe you are better to hire someone who can program such a module for you.


All times are GMT -8. The time now is 08:04 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.