Zen Follower
- Join Date:
- Sep 2006
- Posts:
- 165
- Plugin Contributions:
- 0
DUAL Pricing v2
Sorted it - took me since the last message to find the problem, fix and test.
The problem was in the includes/classes/shopping_cart.php file
Views: 363,340
Zen Follower
Sorted it - took me since the last message to find the problem, fix and test.
The problem was in the includes/classes/shopping_cart.php file
Zen Follower
I am back on trying to find a solution for my needs. A previous post is quoted below. Basically I have Dual Pricing & respective fixes implemented and working fine. However I am really focused on the wholesale side. The retail prices listed are more of a service. When I put something on sale, it is to the wholesale customer which is not happening as stated in the quoted post. When I go to the admin and set up a sale price, i need it to apply to the wholesale price and only show when logged in as a wholesale customer. Any thoughts?
Thanks
idc1:
The below is from edingtons fix:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
$special_price = false;
} else {
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
return false;
} else {
The code works as follows:
When logged in - sales price does NOT display.
When not logged in - sales price displays.I have yet to get the reverse to happen. I want:
When logged in - sales price displays.
When not logged in - sales price does not display.How can I make this happen? If I change
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' )to
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] = '0' )
That made the sales price display both when logged in and not logged in.
Totally Zenned
This is untested, but should work:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] == '0' ) {
Zen Follower
jackie.taferner:
This is untested, but should work:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] == '0' ) {
**Thank you for the input Jackie. I tried it with no success. I also tried several other combinations...I found none of them to work either. Some of the things I attempted are noted in red. I believe this is the only portion in includes/functions/functions_prices.php to control when to show sales price. Any other suggestions?**
//get specials price or sale price
function zen_get_products_special_price($product_id, $specials_price_only=false) {
global $db;
$product = $db->Execute("select products_price, products_model, products_priced_by_attribute from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
if ($product->RecordCount() > 0) {
// $product_price = $product->fields['products_price'];
$product_price = zen_get_products_base_price($product_id);
} else {
return false;
}
$specials = $db->Execute("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status='1'");
//I tried making next line ==0, !=1
if ($_SESSION['customers_wholesale'] && $_SESSION['customers_wholesale'] != '1' ) {
//I tried making next line =true
$special_price = false;
} else {
if ($specials->RecordCount() > 0) {
// if ($product->fields['products_priced_by_attribute'] == 1) {
$special_price = $specials->fields['specials_new_products_price'];
} else {
$special_price = false;
}
}
if(substr($product->fields['products_model'], 0, 4) == 'GIFT') { //Never apply a salededuction to Ian Wilson's Giftvouchers
if (zen_not_null($special_price)) {
return $special_price;
} else {
return false;
}
}
// return special price only
//I tried making next line ==0, !=1
if ($_SESSION['customers_wholesale'] && $_SESSION['customers_wholesale'] != '1' ) {
return false;
} else {
if ($specials_price_only==true) {
if (zen_not_null($special_price)) {
return $special_price;
} else {
return false;
}
} else {
// get sale price
Totally Zenned
Try reversing all the content inside the brackets {}. So essentially, use the same code outlined from Edington's fix, but switch the $special_price = false; with all the code that comes after } else {. You'll get something like this:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
// All the display code would go here
} else {
$special_price = false;
}
You might have to do further customizations to prevent sale prices from going into the shopping cart for Retail customers. You mention that Retail prices are displayed a service only - does that mean you do not plan to sell anything Retail, you're only selling Wholesale?
If that's the case, why not hide pricing unless users are logged in. There's a switch in Configuration > Customer Details > Customer Approval Status.
Then, there's a line of code in tpl_product_info_display.php that you can uncomment to show Wholesalers the retail price on the same page, like so:
Retail price: $500
Wholesale price: $300
Here's that section of code:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
// Uncomment the following line if you want wholesalers to be able to see Retail prices while logged in
echo '<span id="retailwhole">Retail Price: ' .$one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == '1') ? TEXT_BASE_PRICE : '') . zen_get_products_display_retail_net_price((int)$_GET['products_id']).'</span><br /> ';
}
Totally Zenned
Ok if I'm going to publish the working wholesale module we have to be clear that it seems now there are 3 half working versions in existence for 1.39h.
What does work in my version:
What has not been tested:
I'm interested to know if anyone wants me to test these modules prior to releasing my version or if there's a wish list of features I could add in before it goes live.
Twitch.
Totally Zenned
twitchtoo:
Ok if I'm going to publish the working wholesale module we have to be clear that it seems now there are 3 half working versions in existence for 1.39h.
What does work in my version:
- retail pricing and display
- wholesale pricing and display
- retail attribute pricing with sold out by attribute
- wholesale attribute pricing with sold out by attribute and grid pricing
- wholesale login that works regardless of the template/multisite being used - uses one database
- bug fixes for the subtotal display problems listed in this forum
What has not been tested:
- zen discount pricing
- zen group pricing
I'm interested to know if anyone wants me to test these modules prior to releasing my version or if there's a wish list of features I could add in before it goes live.
Twitch.
You might as well. If you don't I'm sure someone will be wanting them features a well.
New Zenner
I really need help here! I have NO CLUE as to how to set up the shipping by weight for my 6000 items. (sigh)
I can't understand the system and am just losing it!
HELP please :shocking:
New Zenner
twitchtoo:
Ok if I'm going to publish the working wholesale module we have to be clear that it seems now there are 3 half working versions in existence for 1.39h.
What does work in my version:
- retail pricing and display
- wholesale pricing and display
- retail attribute pricing with sold out by attribute
- wholesale attribute pricing with sold out by attribute and grid pricing
- wholesale login that works regardless of the template/multisite being used - uses one database
- bug fixes for the subtotal display problems listed in this forum
What has not been tested:
- zen discount pricing
- zen group pricing
I'm interested to know if anyone wants me to test these modules prior to releasing my version or if there's a wish list of features I could add in before it goes live.
Twitch.
I am very appreciative of all the contributions to this mod so far by everyone on this thread, not least to DivaVocals for keeping track of all the fixes required along the way, and to Dannati for implementing those fixes and making available his files, which I am currently using.
For my tuppence worth to your question Twitch, I would be keen to see how your version is now, and leave 'wish list' features alone. This way you could benefit from peer testing of what needs testing, we could benefit from the option to use your version of the module if we wish, and extra features can come later if you or anyone else feels so inclined to contribute to it further. Just my thoughts, but great work and thanks everyone who contributes :smile:
Totally Zenned
twitchtoo:
Ok if I'm going to publish the working wholesale module we have to be clear that it seems now there are 3 half working versions in existence for 1.39h.
What does work in my version:
- retail pricing and display
- wholesale pricing and display
- retail attribute pricing with sold out by attribute
- wholesale attribute pricing with sold out by attribute and grid pricing
- wholesale login that works regardless of the template/multisite being used - uses one database
- bug fixes for the subtotal display problems listed in this forum
What has not been tested:
- zen discount pricing
- zen group pricing
I'm interested to know if anyone wants me to test these modules prior to releasing my version or if there's a wish list of features I could add in before it goes live.
Twitch.
Release it and let the chips fall where they may..
Zen Follower
jackie.taferner:
Try reversing all the content inside the brackets {}. So essentially, use the same code outlined from Edington's fix, but switch the $special_price = false; with all the code that comes after } else {. You'll get something like this:
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
// All the display code would go here
} else {
$special_price = false;
}
>
> You might have to do further customizations to prevent sale prices from going into the shopping cart for Retail customers. You mention that Retail prices are displayed a service only - does that mean you do not plan to sell anything Retail, you're only selling Wholesale?
>
> If that's the case, why not hide pricing unless users are logged in. There's a switch in Configuration > Customer Details > Customer Approval Status.
>
> Then, there's a line of code in tpl_product_info_display.php that you can uncomment to show Wholesalers the retail price on the same page, like so:
>
> **Retail price:** $500
> **Wholesale price:** $300
>
> Here's that section of code:
>
> ```
if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
// Uncomment the following line if you want wholesalers to be able to see Retail prices while logged in
echo '<span id="retailwhole">Retail Price: ' .$one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == '1') ? TEXT_BASE_PRICE : '') . zen_get_products_display_retail_net_price((int)$_GET['products_id']).'</span><br /> ';
}
:clap: Thanks Jackie. That worked and I also appreciate the other comments. The only thing I notice (fyi to others who may use this) is: once logged in as wholesale it shows the sales price for both retail & wholesale istead of just for wholesale on the product info page. It's not that big of a deal but if I can hack through the fix I'll post it. The big thing is that it no longer shows the sales price if NOT logged in :clap:
To answer your other question. We do not sell retail. However a lot of users are either 1)too lazy to sign in to see what MSRP is or 2) they enjoy the ability to turn the monitor around and show a customer the products & prices so that the end user feels comfortable about the manufacturer setting a MSRP and not a dealer using some inflated #. As for showing retail & dealer pricing, that happens on the product info page but not the product listing page. I believe this may be because of the column/grid add on.
New Zenner
Please help!
We need this addon for zencart 1.5! ;)
Totally Zenned
ezecca:
Please help!
We need this addon for zencart 1.5! ;)
In case you didn't read through this support thread.. there is no v1.5 version..
New Zenner
I also need this for Zen Cart version 1.5.0. Is there an update to this Duel Pricing plugin that works with the latest Zen Cart?
Thank you.
Totally Zenned
I will be releasing my wholesale pricing for 1.39h shortly, I have also started on a wholesale pricing for 1.5 and things are looking good :)
Twitch.
New Zenner
That sounds great! Do I check back here for the link to the new release?
Also, Zen Cart 1.5 does work with the Dual Pricing 1.8, BUT, it conflicts with the Master Password and the two cannot be used together. Something you may want to think about is putting the Master Password, or something similar, as part of Dual Pricing. Especially since a lot of wholesale stores owners need to login as a customer when they are taking phone orders, email orders, etc.
Thank you!
Totally Zenned
Hello Diva, (or others that can help :))
I have recently installed Dual Pricing - Wholesale Pricing - I am running v1.3.9h
Zen Cart® Versions v1.3.9
Original Author romanus
Last Updated by jackie.taferner - 10 Aug 2011
Downloads 29,159
http://www.zen-cart.com/downloads.php?do=file&id=74
I have installed it twice - or over installed it / re-installed it and I still cannot get it to work at all - NOTHING shows up in admin under any section.
I note this in the readme file "THIS REPLACES GROUP PRICING. IF YOU USE GROUP PRICING THEN DON'T USE THIS."
I am not using Group Pricing, i.e. I have never installed it but it shows up under Customers in Admin so I can only assume it was part of the Zencart package.
Additionally I note a file for admin called 'easypopulate.php' .... does this mean that for this Plug-in to work one has to have the Easy Populate plug-in installed also ?? I can't find anything in the readme file to suggest that.
Looking for some help here :)
cheers,
Mike
Totally Zenned
I tried to add this as a p.s. in edit but it timed out :)
is this how this mod works ?
p.s. here is how I envisaged this working so please correct me where I may have it wrong. On home page I could have a sidebox saying - 'Wholesale Prices available for Resellers' or something similar that went to an ez page explaining what was required for someone to qualify as a Wholesale customer and asking them to respond, maybe via via an email form completing certain information, e.g. their company name, website, business details, etc so that upon receipt of this info you could assess whether to allocate their status as a wholesale customer and at what discount level. Then through admin they would be allocated to that category so when they log in they see pricing to that level.
Is this basically how it works (when install works) ??
Zen Follower
jjj0923:
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.
- 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:
>
> ```php
$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)
>
> ```php
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:
> ```php
// 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!
Hello. I've made the changes on the orders.php page as suggested in this thread to remove the taxes for wholesale accounts, and unfortunately it messes with the tax calculations even for retail customers. Any ideas?
Totally Zenned
I have recently installed Dual Pricing - Wholesale Pricing - I am running v1.3.9h
Zen Cart® Versions v1.3.9
Original Author romanus
Last Updated by jackie.taferner - 10 Aug 2011
Downloads 29,159
http://www.zen-cart.com/downloads.php?do=file&id=74
I have installed it twice - or over installed it / re-installed it and I still cannot get it to work at all - NOTHING shows up in admin under any section - other than prices show as $xxx/0 indicating to me that 'something' is working, but as I said there is nothing at all in admin nor in configuration.
I note this in the readme file "THIS REPLACES GROUP PRICING. IF YOU USE GROUP PRICING THEN DON'T USE THIS."
I am not using Group Pricing, i.e. I have never installed it but it does show up under Customers in Admin so I can only assume it was part of the standard Zencart package.
Additionally I note a file for admin called 'easypopulate.php' .... does this mean that for this Plug-in to work one has to have the Easy Populate plug-in installed also ?? I can't find anything in the readme file to suggest that.
Looking for some help here :) (still)
cheers,
Mike
Fields marked required must be completed.
Tell staff why this post should be reviewed.