Forums / Setting Up Specials and SaleMaker / SaleMaker only discounts base price, not attributes?

SaleMaker only discounts base price, not attributes?

Views: 46,660

Results 1 to 14 of 14
25 Jan 2016, 2:44 AM
#1
fueledbymatt avatar

fueledbymatt

New Zenner

Join Date:
Sep 2015
Location:
Greensburg, PA
Posts:
7
Plugin Contributions:
0

SaleMaker only discounts base price, not attributes?

So I was looking at a product i have on sale right now, I was expecting it to take 15% off the total of the item after all attributes were selected, but then i noticed it was only discounting the base price of the item.

is there a way to make SaleMaker apply the selected discount to the attributes as well?

I tried selecting Product Priced by Attributes, and it doesn't even apply a discount then...

Example:

https://www.fueledbymatt.com/19952005-dodge-neon-and-srt4-c-3_390_10/19952005-dodge-neon-srt4-complete-fuel-system-kit-p-446.html

Selecting the level2 option, e85 option, and fuel pump using walbro 450, the total would normally be 1050.24, and 15% discount should end up with $892.70, but because it's only discounting the base price, it's coming up with $964.88

Help???

25 Jan 2016, 4:47 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

Attributes_controller for the product and looking at applicable attribute(s), what are the settings for the fourth column (is so in original ZC) that is a sort of pink button or an x... Which is it?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Jan 2016, 5:46 AM
#3
fueledbymatt avatar

fueledbymatt

New Zenner

Join Date:
Sep 2015
Location:
Greensburg, PA
Posts:
7
Plugin Contributions:
0

Re: SaleMaker only discounts base price, not attributes?

All of them are normal, not X. I've tried both ways.

i'm about to go digging through the code to find the switches for pricing and start redoing everything lol...

i doubt this has anything to do with the fact i changed salemaker to be able to create sales based on a manufacturer....that was just a simple trigger in one of the files, don't remember which...

25 Jan 2016, 6:03 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

FueledByMatt:

All of them are normal, not X. I've tried both ways.

i'm about to go digging through the code to find the switches for pricing and start redoing everything lol...

i doubt this has anything to do with the fact i changed salemaker to be able to create sales based on a manufacturer....that was just a simple trigger in one of the files, don't remember which...

Might... Depending on how the database was populated as part of processing the manufacturer's sale data. Have you tried marking an item for sale using a different "indicator"? To see that it works...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Jan 2016, 6:11 AM
#5
fueledbymatt avatar

fueledbymatt

New Zenner

Join Date:
Sep 2015
Location:
Greensburg, PA
Posts:
7
Plugin Contributions:
0

Re: SaleMaker only discounts base price, not attributes?

This is the affected code:

      $sale = $db->Execute("select * from " . TABLE_SALEMAKER_SALES . " where sale_categories_all like '%," . $category . ",%' and sale_status = '1' and (sale_date_start <= now() or sale_date_start = '0001-01-01') and (sale_date_end >= now() or sale_date_end = '0001-01-01') and (sale_pricerange_from <= '" . $product_price . "' or sale_pricerange_from = '0') and (sale_pricerange_to >= '" . $product_price . "' or sale_pricerange_to = '0')");
      if ($sale->RecordCount() < 1) {
         return $special_price;
      }
      if (($sale->fields["sale_manufacturer"] == 0) || (($sale->fields["sale_manufacturer"] > 0) && ($product->fields["manufacturers_id"] == $sale->fields["sale_manufacturer"]))) {

This would be public_html/includes/functions/functions_prices.php

25 Jan 2016, 6:33 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

What is your setting for
If a product is a Special?
And is there a special associated with the product?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Jan 2016, 6:47 AM
#7
fueledbymatt avatar

fueledbymatt

New Zenner

Join Date:
Sep 2015
Location:
Greensburg, PA
Posts:
7
Plugin Contributions:
0

Re: SaleMaker only discounts base price, not attributes?

Ignore Specials Price - Apply to Product Price and Replace Special

No special associated, I only use SaleMaker

25 Jan 2016, 6:53 AM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

FueledByMatt:

Ignore Specials Price - Apply to Product Price and Replace Special

No special associated, I only use SaleMaker

Try either changing it to the last one or simply circling back through the salemaker. After doing each of these, I was able to get/show that the base product and attributes were both on sale. Before that saw the same issue described.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Jan 2016, 6:59 AM
#9
fueledbymatt avatar

fueledbymatt

New Zenner

Join Date:
Sep 2015
Location:
Greensburg, PA
Posts:
7
Plugin Contributions:
0

Re: SaleMaker only discounts base price, not attributes?

SWEET!

Yeah I didn't try that last option before....Now i know what to do from now on, lol...thank you!

25 Jan 2016, 11:44 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

FueledByMatt:

SWEET!

Yeah I didn't try that last option before....Now i know what to do from now on, lol...thank you!

Glad it worked, I knew it should somehow and was also surprised when I tried a similar setup on a brand new install... FYI, I did not look through the code posted above to validate or identify any issues. I had found "a solution" that was independent of that modification; however, it may still help others. :)

Where in that file did that additional code need to go?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Dec 2016, 3:32 PM
#11
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: SaleMaker only discounts base price, not attributes?

This issue is still present in Zen Cart 1.5.5b. Here's a scenario:

A product, priced by attributes with a base price set to 0.00, includes two radio-button type attributes (Color: Red, Color: Black). Each of those attributes' prices are set as 50.00 (no price prefix) and the Discounted and Base Price flags are set.

Ensure that there are no "specials" associated with the product.

Set a SaleMaker sale for 50%, selecting Ignore Specials Price - Apply to Product Price and Replace Special from the drop-down selection that will apply to the product.

View the product on the storefront: Its price shows the salemaker price ($50.00 (struck-out), $25.00) ... but each of the attributes' prices still show the non-salemaker price of $50.00; the price when the product is placed in the cart is correct at $25.00.

The source of the issue is in the zen_get_discount_calc function, present in /includes/functions/functions_prices.php (both admin and storefront versions). Under the above scenario, the "discount_type_id" being returned is 5, taking the code down this fragment:

      case ($discount_type_id == 5):
        // No Sale and No Special
//        $sale_maker_discount = 1;
        if (!$attributes_id) {
          $sale_maker_discount = $sale_maker_discount;
        } else {
          // compute attribute amount
          if ($attributes_amount != 0) {
            if ($special_price_discount != 0) {
              [B]$calc = ($attributes_amount * $special_price_discount);[/B]
            } else {
              $calc = $attributes_amount;
            }

            $sale_maker_discount = $calc;
          } else {
            $sale_maker_discount = $sale_maker_discount;
          }
        }
//echo 'How much 3 - ' . $qty . ' : ' . $product_id . ' : ' . $qty . ' x ' .  $attributes_amount . ' vs ' . $check_discount_qty_price . ' - ' . $sale_maker_discount . '<br />';
        break;

... and executing the highlighted portion of that code-block, essentially not applying the SaleMaker discount to the attribute's price. Part of the issue is that the $special_price_discount value (calculated earlier in that function) is set to (int)1.

There's a lot going on in that function and I don't (yet) have a proposed solution, but I do believe that this should be moved to the "Bug Reports".

25 Feb 2017, 7:14 PM
#12
stxmona avatar

stxmona

Zen Follower

Join Date:
Aug 2008
Posts:
103
Plugin Contributions:
0

Re: SaleMaker only discounts base price, not attributes?

I just ran into this problem using Salemaker.
I have attributes that deduct an add on (deduct the pattern etc) that should always be deducted using the discount amount of the inventory item. Yes I have the "Apply Discounts Used by Product Special/Sale:" toggled to Yes just for this attribute.
I recently used Salemaker to put a category of kits On Sale and it won't deduct the attribute properly.

Is there a fix for this yet? I browsed thru the forum and didn't see it. Pardon me if there is and post a link please.
If there isn't, I know I will have to do my flash sales on kits using a different method.

Still love the Zencart and appreciate everyone's hard work!
Thank you,
Mona
www.QuiltsInMontana.com

9 Mar 2017, 8:21 PM
#13
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

I believe that the code modification shown in this post and presented as a pull request to the ZC development team fix this issue. In total there were basically three functions that seemed to be problematic, although one thing I'm trying to identify is if the solution provided which moves processing further into the zen_get_attributes_price_final functions_prices function to then call the zen_get_discount_calc function from within in there (and some modifications to that function as well) is the direction desired to go or instead to perform (reperform?) calculations in the attributes.php file to properly calculate/display the value(s) that would otherwise be expected.

With the proposed solution I was able to obtain the desired/expected results in the testing that was performed, though still wondering if the testing was extensive enough. Tried a lot of variables and changes to them, between price-by-attributes with a base price on the product, no base price on the product and just attribute price(s), sales, and specials...

While I indicates in that thread that the solution likely would support what was requested here, in closing browsers I realized I probably should cross post this for others to test it out and see. While the changes were made in ZC 1.5.5, it seems that the issue has existed for some time.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Jan 2019, 10:00 PM
#14
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SaleMaker only discounts base price, not attributes?

Seems that the following ZC commits/pulls might correct both of the issues described here. The commits/pulls are based on changes made from ZC 1.5.5 to ZC 1.5.6 (and corrections made to the first pull to ZC 1.5.6):
https://github.com/mc12345678/zc-v1-series/commit/ffa8646c177a9c814b8e298a50726016a5fe4b5a
https://github.com/zencart/zencart/pull/1404/files
https://github.com/zencart/zencart/pull/2075/files

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...