Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Wholesale pricing table on products.tpl?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 12-12-2005, 09:10 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Quote:
Originally Posted by balinor
Yes, quantity discounts are wholesale pricing. If you have quantity ranges set up, it displays a little html chart of the price ranges.

I have not seen the little wholesale table since moving to the 4.x branch.

I also see no place in the default cart install to define quantity discounts. Is this done with a mod?
Reply With Quote
  #12  
Old 12-13-2005, 01:49 AM
 
sundance sundance is offline
 

Member
  
Join Date: Oct 2004
Posts: 27
 

Default

Hi balinor and Light.

Let me just clarify what I was talking about - I know the terminology 'wholesale pricing' isn't very helpful here.

As balinor suggests, we aren't looking at the wholesale member pricing - we are looking at the quantity discounts set in the 'Wholesale prices' section under 'modify product' in the [admin] section, like this:

http://www.x-cart.com/demo/provider/product_modify.php?mode=select&productid=17437&sec tion=wholesale

Once these prices have been entered, a 'wholesale prices' box appears in the product.tpl, for the members for whom you have set the membership level - which can be All members. This isn't a very good description of what the box is, it should be a 'quantity discounts' box, but that is the terminology used in the 'cart.

However, this quantity discounts box does not appear in the products.tpl, and that is what I am starting to code now - something that shows the 'quantity discounts' box in products.tpl

More soon,
Rob.
__________________
Xcart 4.0.17
Reply With Quote
  #13  
Old 12-13-2005, 03:46 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Good explination And yes, getting that box to appear on the products.tpl is a bit of work.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #14  
Old 12-13-2005, 08:44 AM
 
sundance sundance is offline
 

Member
  
Join Date: Oct 2004
Posts: 27
 

Default

Ok - I'm really starting to get somewhere with this.

I should think I will have something to show you all within the next day.

My primary concern at the moment is that the mod is hack-o-rific, and I am going to have to make it neat and tidy in order to release it as anything you could safely describe as a mod.

I can't believe how rusty my php is - I am still fighting a mental battle to remember how to construct and reference associative arrays. It is hurting my head.

Still, have to go out for dinner now - more soon.

Rob.
__________________
Xcart 4.0.17
Reply With Quote
  #15  
Old 12-13-2005, 09:41 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Ah HA!

I use this feature totally differently so I never see the table anymore. I only enter one wholesale price and apply it to a wholesale membership.

This just changes the actual price depending on memberlevel and does not bring up the table. Adding more than one brings up the table.

Really this section now allows you to set wholesale pricing and volume discount. I did not know that and I have been using the cart for almost three years.

Sorry to cause a fuss. Good luck in your quest
Reply With Quote
  #16  
Old 12-13-2005, 05:20 PM
 
sundance sundance is offline
 

Member
  
Join Date: Oct 2004
Posts: 27
 

Default

No problem Light Speed.

It is the terminology that was confusing, not You. Please don't worry about causing a fuss, I would have felt a right muppet if I had continued to do the work and it HAD been something that was already done...

I have finished the mod now, in the sense that it is working, and it is displaying a table on my products.tpl similar to the one on the product.tpl when you have set quantity discount 'Wholesale Prices' under the product modification screen.

It is now 3am here, the coffee is just wearing off, so I will tidy it up and publish it after some sleep.

I am reluctant to post this URL to it working, because the site it is working on is NOWHERE NEAR finished... but you can see the mod in operation here:

Edit*
Sorry URL edited out while I tidy code.
/Edit*

I show you that category just to prove it works with more than one line of quantity discounts.

Sleep beckons. I will give you the code later when it is neat enough.
Rob.
__________________
Xcart 4.0.17
Reply With Quote
  #17  
Old 12-13-2005, 06:04 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default

Good job!

That site makes me want to have a glass of wine
Reply With Quote
  #18  
Old 12-13-2005, 06:05 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Nice work Sundance! Having done this once before (on 3.x) I remember what a nightmare it was. Looking forward to seeing the completed mod!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #19  
Old 12-14-2005, 02:33 AM
 
sundance sundance is offline
 

Member
  
Join Date: Oct 2004
Posts: 27
 

Default

Ok,

I haven't really tidied it up very much... sorry - got to go out to lunch (it's a tough life). It hasn't got a proper mod layout, it is all just embedded in the products.tpl using {php} brackets (I know! I know!), and it is probably not as efficient as it could be in its use of arrays.

EDIT: Still bug-fixing - currently have fixes for:
displaying wholesale prices when there aren't any (especially in search results)


It does work for me, though.... I promise I will tidy it up later - I just thought you might like to see it!

Here is my mod for products.tpl

You have to put this code in your products.tpl where you want the table to appear... obviously a table may not suit your needs - my next release of the mod will be tidier and hopefully clearer to see how you can customize it to your won look and feel.

Code:
{assign var="pid" value=$products[product].productid} {* sundance:extra_fields start *} {assign var="pid" value=$products[product].productid} {* get wholesale wholesale pricing data for product *} {php} $prodid=$this->_tpl_vars['pid']; $results = func_query("SELECT * FROM xcart_pricing WHERE productid='$prodid' ORDER BY quantity"); $this->assign("sv_val",$results); {/php} {* clear count and array values for each product to appear *} {php}$i=0; $boqu=""; $bopr=""; {/php} {* scan through each set of wholesale pricing *} {foreach from=$sv_val item=field} {php} $boqu[]=$this->_tpl_vars['sv_val'][$i]['quantity'] ; $bopr[]=$this->_tpl_vars['sv_val'][$i]['price'] ; $i++; {/php} {/foreach} <table bgcolor="#e9e9e9" border="0" cellspacing="5" cellpadding="0"> <tr> {* set up before-and-after array keys and delimiters for display quantiity values *} {php} foreach ($boqu as $key => $entry) { $pre = " - ".($entry-1); $prerec = ($key-1); $next = ($key+1); if ($boqu[$next]!="") { $nextrec = " - ".($boqu[$next]-1); } else { $nextrec = "+"; } {/php} {* setup initial price and discount colums *} {php}if ($prerec==0) { {/php} <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> {php} echo "Quantity Purchased:"; {/php} </td> </tr> <tr> <td> {php} echo "Unit Price:"; {/php} </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> {php} echo "$boqu[$prerec]$pre"; {/php} </td> </tr> <tr> <td> {php} echo "$bopr[$prerec]"; {/php} </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> {php} echo "$boqu[$key]$nextrec"; {/php} </td> </tr> <tr> <td> {php} echo "$bopr[$key]"; {/php} </td> </tr> </table> </td> {php} } {/php} {* display additional columns for multiple prices: *} {php} if ($prerec>=1) { {/php} <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="DialogTitle"> {php} echo "$boqu[$key]$nextrec"; {/php} </td> </tr> <tr> <td> {php} echo "$bopr[$key]"; {/php} </td> </tr> </table> </td> {php}}{/php} {php} } // foreach end {/php} </tr> </table>

So fiddle about with it - comments and questions are welcome.... I accept that the formatting won't suit everybodys products.tpl layout, and even more that it is a dirty hack - I will work on making it more digestible later,

Rob.
__________________
Xcart 4.0.17
Reply With Quote
  #20  
Old 09-26-2006, 08:56 AM
  frankdux's Avatar 
frankdux frankdux is offline
 

Senior Member
  
Join Date: Jul 2004
Location: Manchester, NH, USA
Posts: 125
 

Default Re: Wholesale pricing table on products.tpl?

Sundance, did this approach work out ok for you?... or does anyone have this working?
__________________
X-Cart: 4.0.18
Linux, Apache, MySQL: 4.1.16, PHP: 4.4.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:51 AM.

   

 
X-Cart forums © 2001-2020