Zen Cart Logo

DUAL Pricing v2

Views: 363,352

Results 921 to 940 of 1,504
25 Feb 2012, 12:41 AM
#921
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

DUAL Pricing v2

Weird, I have searched this thread using as many keywords as I could think of but I didn't come across a solution. I'll search again!

DivaVocals:

Posted in this thread..

(hint: I even posted the link to the fix just a few posts up -- which is why it pays to search the thread:yes:)

25 Feb 2012, 12:44 AM
#922
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: DUAL Pricing v2

Huh found it, don't know how I missed that, but thanks, it worked great!

25 Feb 2012, 2:05 AM
#923
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: DUAL Pricing v2

Danielle:

The issue with the attribute pricing not being carried into the shopping cart has never been solved, correct? Does anyone who has worked on this mod have any thoughts on how to fix it? I'm happy to give it a shot, just wondering if anyone has tried yet and can provide a bit of direction :) If I figure it out, I'll post the fix!

Thanks!

Check out my posts, it has been fixed for 139h.

Twitch.

25 Feb 2012, 2:17 AM
#924
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: DUAL Pricing v2

twitchtoo:

Check out my posts, it has been fixed for 139h.

Twitch.
Those are the posts I directed her to...

26 Feb 2012, 10:53 AM
#925
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

I was wondering if anyone succeeded in displaying the prices without taxes for wholesale price. Standard pricing is with taxes. Since the last question about this is back to 2006 (post item #13), things could be changed. I've read that it's possible in this thread, but not how it should be done.

gr.

26 Feb 2012, 2:04 PM
#926
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

roekoe:

I was wondering if anyone succeeded in displaying the prices without taxes for wholesale price. Standard pricing is with taxes. Since the last question about this is back to 2006 (post item #13), things could be changed. I've read that it's possible in this thread, but not how it should be done.

gr.

I have one question for you...do you apply tax to all order or just tax to people ordering in certain states?

the reason I ask is because I have this add-on installed also and I charge tax in only one state. I have not taken the time to go into the code and stop charging tax to 'dealers' in my own state but this should not be difficult to do. If you do the same as I then I'll be happy to share my code with you once I'm done. It shouldnt take more more than 30 or 45 minutes to figure it out and test it. I'm running 1.39h

lemme know

26 Feb 2012, 2:19 PM
#927
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

jjj0923:

I have one question for you...do you apply tax to all order or just tax to people ordering in certain states?

the reason I ask is because I have this add-on installed also and I charge tax in only one state. I have not taken the time to go into the code and stop charging tax to 'dealers' in my own state but this should not be difficult to do. If you do the same as I then I'll be happy to share my code with you once I'm done. It shouldnt take more more than 30 or 45 minutes to figure it out and test it. I'm running 1.39h

lemme know

Hi,

The tax is applied to all customers, because we have no states in my country. My country is as big as the smallest state of your country i guess :D.
I've seen a module in this topic that allows multiple tax rates voor "special" customers; Customer Tax Exempt post item #290

I'm testing with version 1.5, currently using 1.3.8 for production

26 Feb 2012, 4:05 PM
#928
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

ok - well I just wrote the code and tested it.

not too difficult

one module needs to be modified:

/includes/classes/order.php

I made three changes to this module. I have not looked at 1.5 but I suspect the code is very similar

You can take a look in your code and see how similar they are.

  1. code needs to be added to read the customers_whole field from the customers table so that you can check to see if this is a wholesaler/dealer (and skip the sales tax calculation)

that''s easy.

find this code:

$customer_address_query = "select c.customers_firstname, c.customers_lastname, c.customers_telephone,

and replace it with:

$customer_address_query = "select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_whole,

then find:

      // find product's tax rate and description
      $products_tax = $this->products[$index]['tax'];
      $products_tax_description = $this->products[$index]['tax_description'];

and insert this code after it (please bear in the mind that this code may be superfluous since we'll be avoiding the sales tax calculations altogether next, but I like to be safe)

     if ($customer_address->fields['customers_whole'] > 0)
      { $products_tax = 0;
        $this->products[$index]['tax'] = 0;
        $tax_add = 0;
        $this->products[$index]['tax_description'] = '';
      }

then finally there a chunk of code RIGHT BELOW what we just added that does all the sales tax calculation.

what I found in the standard 1.39 module is shown below:

      if (DISPLAY_PRICE_WITH_TAX == 'true') {
        // calculate the amount of tax "inc"luded in price (used if tax-in pricing is enabled)
        $tax_add = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
      } else {
        // calculate the amount of tax for this product (assuming tax is NOT included in the price)
//        $tax_add = zen_round(($products_tax / 100) * $shown_price, $currencies->currencies[$this->info['currency']]['decimal_places']);
        $tax_add = ($products_tax/100) * $shown_price;
      }
      $this->info['tax'] += $tax_add;
      foreach ($taxRates as $taxDescription=>$taxRate)
      {
        $taxAdd = zen_calculate_tax($this->products[$index]['final_price']*$this->products[$index]['qty'], $taxRate)
                +  zen_calculate_tax($this->products[$index]['onetime_charges'], $taxRate);
        if (isset($this->info['tax_groups'][$taxDescription]))
        {
          $this->info['tax_groups'][$taxDescription] += $taxAdd;
        } else
        {
          $this->info['tax_groups'][$taxDescription] = $taxAdd;
        }
      }

I added an if statement to wrap this code and only execute it if the customers is a non wholesaler/dealer

my code is shown below:

// jjj added
 if ($customer_address->fields['customers_whole'] == 0)
    {	
      if (DISPLAY_PRICE_WITH_TAX == 'true') {
        // calculate the amount of tax "inc"luded in price (used if tax-in pricing is enabled)
        $tax_add = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
      } else {
        // calculate the amount of tax for this product (assuming tax is NOT included in the price)
//        $tax_add = zen_round(($products_tax / 100) * $shown_price, $currencies->currencies[$this->info['currency']]['decimal_places']);
        $tax_add = ($products_tax/100) * $shown_price;
      }
      $this->info['tax'] += $tax_add;
      foreach ($taxRates as $taxDescription=>$taxRate)
      {
        $taxAdd = zen_calculate_tax($this->products[$index]['final_price']*$this->products[$index]['qty'], $taxRate)
                +  zen_calculate_tax($this->products[$index]['onetime_charges'], $taxRate);
        if (isset($this->info['tax_groups'][$taxDescription]))
        {
          $this->info['tax_groups'][$taxDescription] += $taxAdd;
        } else
        {
          $this->info['tax_groups'][$taxDescription] = $taxAdd;
        }
      }
// jjj added
      }

GOOD LUCK!

26 Feb 2012, 5:03 PM
#929
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

by the way - just for the heck of it - I looked at the 1.5 code and the loop code you'd put the if statement around is this in that 1.5 module. the module has changed somewhat from 1.39h

      
      $totalTaxAdd = 0;
      foreach ($taxRates as $taxDescription=>$taxRate)
      {
        $taxAdd = 0;
        if ($taxDescription == $products_tax_description)
        {
          if (DISPLAY_PRICE_WITH_TAX == 'true')
          {
            $taxAdd = zen_round($shown_price / (100 + $this->products[$index]['tax']) * $this->products[$index]['tax'], $decimals);
          } else
          {
              $taxAdd = zen_calculate_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
                      +  zen_round(zen_calculate_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
          }
          if (isset($this->info['tax_groups'][$taxDescription]))
          {
            $this->info['tax_groups'][$taxDescription] += $taxAdd;
          } else
          {
            $this->info['tax_groups'][$taxDescription] = $taxAdd;
          }
        }
        $totalTaxAdd += $taxAdd;
      }
      $this->info['tax'] += $totalTaxAdd;
26 Feb 2012, 5:53 PM
#930
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

I noticed the difference indeed. Trying to get it working right now...

26 Feb 2012, 6:41 PM
#931
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

roekoe:

I noticed the difference indeed. Trying to get it working right now...

EDIT: First of all many thanks for your help, i really appreciate it.

I think i managed it, althoug there's an error with the TAX calculation. I've made a testorder with customer whole sale customer.

  1. Login as a whole sale customer
  2. Prices still shown including taxes
  3. Added 10 products of $2.98 = $29.80
  4. Added 10 products of $3.57 = $35.70
  5. Shopping card displays amount of $65.45. This is wrong should be $65.50
  6. Go to checkout (Step 1)in store, shipping cost are added
  7. Continue checkout; Sub-total is displayed (Step 2): $ 65.50 which is correct
  8. Shopping card sidebox still displays wrong amount
  9. Last step, the amount is still correct
  10. Order confirmed

So, I think there is an error with TAX calculation. Although this line shoud be ok: $tax_add = ($products_tax/100) * $shown_price;

EDIT 2: Logging in as a "normal" customer the prices are displayed are correctly

26 Feb 2012, 7:03 PM
#932
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

roekoe:

EDIT: First of all many thanks for your help, i really appreciate it.

I think i managed it, althoug there's an error with the TAX calculation. I've made a testorder with customer whole sale customer.

  1. Login as a whole sale customer
  2. Prices still shown including taxes
  3. Added 10 products of $2.98 = $29.80
  4. Added 10 products of $3.57 = $35.70
  5. Shopping card displays amount of $65.45. This is wrong should be $65.50
  6. Go to checkout (Step 1)in store, shipping cost are added
  7. Continue checkout; Sub-total is displayed (Step 2): $ 65.50 which is correct
  8. Shopping card sidebox still displays wrong amount
  9. Last step, the amount is still correct
  10. Order confirmed

So, I think there is an error with TAX calculation. Although this line shoud be ok: $tax_add = ($products_tax/100) * $shown_price;

EDIT 2: Logging in as a "normal" customer the prices are displayed are correctly

since there should not be any tax to wholesale why not just set it to zero
and
I guess it begs the question - was there a sales tax error calculation problem before you modified any of the code. perhaps the differences in a few pennies could be some sort of rounding error that you discovered in 1.50?

26 Feb 2012, 7:09 PM
#933
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

jjj0923:

I guess it begs the question - was there a sales tax error calculation problem before you modified any of the code. perhaps the differences in a few pennies could be some sort of rounding error that you discovered in 1.50?

:oops: There is actually. I've restored the default order.php and the calculation is wrong again. I'm sorry my bad, i'll try to fix this rounding error. Let you now asap.

Thanks again for your help

26 Feb 2012, 10:13 PM
#934
amirshawn80 avatar

amirshawn80

New Zenner

Join Date:
Jun 2010
Posts:
27
Plugin Contributions:
0

Re: DUAL Pricing v2

divagal:

I made the changes to my functions_prices.php as per edingtoncollection post. However, the wholesale account holder is still seeing the specials price and not the wholesale price.

This is such a great mod, I can't believe someone doesn't have a solution to this.

Anyone?

I was wondering if you ever figured this out. I'm having the same problem, I also changed the code in functions_prices.php, but it didn't seem to fix anything. Specials override the wholesale price, and salemaker adds a discount to the wholesale price.

If not, does anyone know what I should be doing?

BTW i'm using 1.3.9f and 1.8 of this mod.

Thank You!

26 Feb 2012, 10:59 PM
#935
amirshawn80 avatar

amirshawn80

New Zenner

Join Date:
Jun 2010
Posts:
27
Plugin Contributions:
0

Re: DUAL Pricing v2

amirshawn80:

I was wondering if you ever figured this out. I'm having the same problem, I also changed the code in functions_prices.php, but it didn't seem to fix anything. Specials override the wholesale price, and salemaker adds a discount to the wholesale price.

If not, does anyone know what I should be doing?

BTW i'm using 1.3.9f and 1.8 of this mod.

Thank You!

I just figured it out, just a mistake on my end, but an easy one to make. I was editing the functions_prices.php file in the /admin/ section, when I should have been editing it in the /catalog/ section. I actually edited both files, I'm not sure if that was the right thing to do, but it seems to be working.

I think it would be very helpful for newcomers if when posting a fix to a problem and you tell people to edit a file name, it would be great to include the path to the file. This could save people a lot of hassle.

Either way I am very thankful you guys came up with a solution, You guys & gals are all AWESOME!!:cool:

26 Feb 2012, 11:11 PM
#936
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

amirshawn80:

I was wondering if you ever figured this out. I'm having the same problem, I also changed the code in functions_prices.php, but it didn't seem to fix anything. Specials override the wholesale price, and salemaker adds a discount to the wholesale price.

If not, does anyone know what I should be doing?

BTW i'm using 1.3.9f and 1.8 of this mod.

Thank You!

I figured it out and fixed it in 1.39h

27 Feb 2012, 4:34 PM
#937
mr_steu avatar

mr_steu

New Zenner

Join Date:
Feb 2012
Posts:
3
Plugin Contributions:
0

Re: DUAL Pricing v2

Hi anyone, i hava a problem with this add-on,
in to the shopping cart not displaying the correct pricing if the User is a WHOLESALE

Discount Value - This value is used in Shopping Cart instead of TEXT_PRODUCTS_DISCOUNT_PRICE_W.

Thanks.

27 Feb 2012, 4:39 PM
#938
jjj0923 avatar

jjj0923

New Zenner

Join Date:
Nov 2011
Posts:
59
Plugin Contributions:
0

Re: DUAL Pricing v2

mr.steu:

Hi anyone, i hava a problem with this add-on,
in to the shopping cart not displaying the correct pricing if the User is a WHOLESALE

Discount Value - This value is used in Shopping Cart instead of TEXT_PRODUCTS_DISCOUNT_PRICE_W.

Thanks.

what version of zencart are you using?

27 Feb 2012, 8:18 PM
#939
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

roekoe:

:oops: There is actually. I've restored the default order.php and the calculation is wrong again. I'm sorry my bad, i'll try to fix this rounding error. Let you now asap.

Thanks again for your help

Back again. I tested with version 1.3.9h and the same calculating "error" occurs. I've read that this is a known issue with ZC and rounding up of prices.

Price EX VAT: $3.7815 displayed as: $3.78 in store
buy 10 products, price displayed as: $37.82 in store

It seems that version 1.5 does is calculating on a different matter, but i'm not convinced of it.

27 Feb 2012, 9:26 PM
#940
roekoe avatar

roekoe

New Zenner

Join Date:
Feb 2010
Posts:
38
Plugin Contributions:
0

Re: DUAL Pricing v2

roekoe:

Back again. I tested with version 1.3.9h and the same calculating "error" occurs. I've read that this is a known issue with ZC and rounding up of prices.

Price EX VAT: $3.7815 displayed as: $3.78 in store
buy 10 products, price displayed as: $37.82 in store

It seems that version 1.5 does is calculating on a different matter, but i'm not convinced of it.

I can confirm that with ZC 1.5 the calculating is done is a better proper way:

Price EX VAT: $3.7815 displayed as: $3.78 in store
buy 10 products, price displayed as: $37.80 in store