| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
drop down quantities with wholesale prices | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
drop down quantities with wholesale prices
This is a hack and not a completed modification.
When adding a product to my cart, the quantities drop down selector didn't really float my boat. It just didn't seem useful to have a drop down list that counted from 1-1000 or whatever. Why not a text input? Anyway.. It seemed especially silly when I enabled wholesale pricing, which displays a table of price breaks just beneath the drop down. So, I decided to merge the wholesale pricing into the dropdown box. It was actually pretty easy to do which leads me to wonder if I did something wrong In skin1/customer/main/product.tpl, I changed the section of code that builds the dropdown list to incorporate the logic from skin1/customer/main/product_prices.tpl. in skin1/customer/main/product.tpl, look for the the following: Code:
and then change it to something like this: Code:
This creates a dropdown that lists each wholesale discount available for the product. (1 for $0.052 each, 1000 for $0.047 each, etc) and you can select the level you want to buy at and add that number to your cart. I don't use product options or variants so this was fairly simple for me. YMMV. Also, I hard coded in the "for" and the "each", which should be extracted into a lang variable. If anyone sees any improvements or lack of foresight, please let me know. You can see this hack at work here: http://www.gaussboys.com/xcart/product.php?productid=1&cat=3&page=1 BTW, I did a few other cosmetic changes to the product.tpl like remove the wholesale pricing table.
__________________
Version 4.0.18 |
|||||||
#2
|
|||||||
|
|||||||
Moving to Custom Mods...a hack is still a mod
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||
|
|||||||
Re: drop down quantities with wholesale prices
I've tried this on version 4.1.3
It's working to a point. http://www.embroideredcaps.info/4175-Brushed-Heavy-Cotton-with-Piping-Tri-Colour-p-12.html Should I be telling smarty something so it doesn't display more values than available from the wholesale quantitys table? regards Ant
__________________
Xcart 4.4.? Xcart Next Litecommerce with Drupal http://www.corbywebworx.com Custom Mods, Hosting and Support for Xcart-Next and LiteCommerce |
|||||||
#4
|
|||||||
|
|||||||
Re: drop down quantities with wholesale prices
thanks gaussboy, works nicely, although I have 2 problems:
1) In product detail page the product only has 2 wholesale prices defined (qty= 2 and qty=3+). The drop down only shows the items as they should for qty=1, 2 and 3, but not for the remaining (4, 5, etc). 2) I'd like to add the same facility to the catalog pages (skin1/customer/main/products.tpl). I located the same hunk, replaced with yours but it doesn't work. Any ideas why? Here's what I have: ---------------------------- {assign var="start_quantity" value=$product.min_amount} {/if} <option value="0">0</option> {* Original quantity drop down START {section name=quantity loop=$mq start=$start_quantity} <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION> {/section} Original quantity drop down END *} {* MODIFIED quantity drop down START *} {if $product_wholesale ne ""} {section name=wholesale loop=$product_wholesale} {if $smarty.section.wholesale.first} <OPTION value="{$product.min_amount}">{$product.min_amount }x{include file="currency.tpl" value=$product.taxed_price}{$lng.lbl_each}</OPTION> {/if} <OPTION value="{$product_wholesale[wholesale].quantity}">{$product_wholesale[wholesale].quantity}x{include file="currency.tpl" value=$product_wholesale[wholesale].taxed_price}{$lng.lbl_each}</OPTION> {/section} {/if} {if $product_wholesale eq ""} {section name=quantity loop=$mq start=$start_quantity} <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION> {/section} {/if} {* MODIFIED quantity drop down END *} </SELECT> {/if} </TD> ---------------------------- Thanks, nice hack!
__________________
------------------------ X-Cart: 4.0.15 Gold Apache 2.0.52 / PHP 4.4.6 / MySQL Server: 4.1.22-standard-log, client: 5.0.27 |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|