X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Showing discounted price (https://forum.x-cart.com/showthread.php?t=28320)

Alexander Whillas 01-25-2007 11:44 AM

Showing discounted price
 
So,

I've searched here and not found anything that addresses this issue: My client wants to have a sale to clear stock. 30% discount on selected items type thing. I can see the 'discount_avail' flag for a product, but I want to know how I can

a) get the discount value (i.e. 30%)
b) show the modified price when the user is browsing the products not just at the checkout

?

I'm figuring these must be something easy I'm missing here...?

balinor 01-25-2007 11:58 AM

Re: Showing discounted price
 
it should show the discount by default on the category pages, and in the discount "graphic" on the detail pages. Did you perhaps modify the templates and delete that info?

Moving to template editing.

neaisha 01-25-2007 12:02 PM

Re: Showing discounted price
 
balinor, i think he means that he want's to show the value (amount they're saving) Like 30% Off, You Save x-amount.

right now the discount will strike through in products.tpl and products_t.tpl but on the details page, it just has the discount graphic and displays the modified price (no strike through or difference in savings)

Alexander Whillas 01-25-2007 12:06 PM

Re: Showing discounted price
 
Ah so!

So you mean it DOES displays the modified price on the details page? I've mod'ed the template so heavily that I must have lost it.

Whats the 'products_t.tpl' template for?

neaisha 01-25-2007 12:12 PM

Re: Showing discounted price
 
products_t.tpl is the multi-column display for products within a category (before you click on a product and get to the details page).

on the product details page, there should be a starburst on the upper right-hand side and within that starburst, it will say Save x%.

but if you're looking to have the change in price denoted on product.tpl, it does not currently do that. it only does it within products.tpl and products_t.tpl

would be a good option so if you figure it out, let me know.

Alexander Whillas 01-25-2007 12:19 PM

Re: Showing discounted price
 
So you don't know :(

If its done on the products.tpl then it must be possible ont he details page... unless its calculated outside the Smarty template...?

neaisha 01-25-2007 12:38 PM

Re: Showing discounted price
 
i think you can pull the code from products.tpl. you just have to find where it's calculating the price. and then just replace the corresponding code in product.tpl.

i'm going to try it but i'm no balinor :-) i think it's should be relatively easy to achieve.

neaisha 01-25-2007 12:52 PM

Re: Showing discounted price
 
ok, i tried it. didn't work. there's an issue with the table tag. i think if you can resolve the issues with the table tag, it's doable.

Alexander Whillas 01-25-2007 12:55 PM

Re: Showing discounted price
 
But you got the price to come out correctly? Could you paste your template code here. Perhaps i can fix it

neaisha 01-25-2007 01:02 PM

Re: Showing discounted price
 
nah nah nah....i didnt get it to come out correctly b/c the tables are nested.

the code from products.tpl should be somewhere here...

Code:

{if $active_modules.Subscriptions ne "" and ($products[product].catalogprice gt 0 or $products[product].sub_priceplan gt 0)}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0}
<font class="MarketPrice">{$lng.lbl_market_price}: <s>
{include file="currency.tpl" value=$products[product].list_price}
</s></font><br />
{/if}
{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
<s>
{/if}
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</font><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
</s>
{/if}
{if $products[product].taxes}
<br />
<div class="PListTaxBox">{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}</div>
{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
{include file="modules/Special_Offers/customer/product_special_price.tpl" product=$products[product]}
{/if}
{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>
{/if}
{/if}


the code from product.tpl should be somewhere here...

Code:

{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].taxed_price ne 0}
{if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0}
<font class="MarketPrice">{$lng.lbl_market_price}: <s>
{include file="currency.tpl" value=$products[product].list_price}
</s></font><br />
{/if}
{/if}
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</font><br /><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}<br />{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>
{/if}
{/if}


this will display incorrectly but i THINK if you can resolve the table issue, it'll work out fine.

neaisha 01-25-2007 01:29 PM

Re: Showing discounted price
 
hmm...i've tried but maybe it's not within this code. i can only find one line in product.tpl that differs from products.tpl and changing that line doesnt help. sowwy!

Alexander Whillas 01-25-2007 01:52 PM

Re: Showing discounted price
 
The 'discount' that its calculating here is the difference in 'price' (Market price) and list price (online price). I can't see where it pulls in the discount value and makes a calculation based on this.

I was talking about

1. flagging an item 'Available for global discount',
2. setting the global discount as a provider to a percentage value
3. then hoping to see it affect all the items price from step 1.

Maybe its not possible :(

JWait 01-25-2007 03:41 PM

Re: Showing discounted price
 
Quote:

Originally Posted by Alexander Whillas
So,

I've searched here and not found anything that addresses this issue: My client wants to have a sale to clear stock. 30% discount on selected items type thing. I can see the 'discount_avail' flag for a product, but I want to know how I can

a) get the discount value (i.e. 30%)
b) show the modified price when the user is browsing the products not just at the checkout

?

I'm figuring these must be something easy I'm missing here...?


I think (but not sure) that the 'discount_avail' applies to membership level, like if you sell wholesale to certain members (customers). That way "Wholesale" customers would see prices with the dicount applied to the products with the 'discount_avail' and normal pricing on items that it doesn't apply.

Perhaps someone that actually knows for sure will chime in.

JWait 01-25-2007 03:53 PM

Re: Showing discounted price
 
Quote:

Originally Posted by neaisha
nah nah nah....i didnt get it to come out correctly b/c the tables are nested.

the code from products.tpl should be somewhere here...

<snip>

this will display incorrectly but i THINK if you can resolve the table issue, it'll work out fine.


The areas that you are referencing ("Market Price" and "Product Price") are what I was referring to in the other thread ("Specials") http://forum.x-cart.com/showthread.php?t=1144&page=5

The has to be some way to query the database to find products that have a difference and display them, I just don't know how.

Alexander Whillas 01-26-2007 01:14 AM

Re: Showing discounted price
 
Actually, I think you could just hit the 'discounts' table yourself (inthe PHP) for the discount value and then add it to Smarty before calling the template THEN do a calculation. Actually, it would be better to loop over the $products array int he PHP and make a new column called 'discounted price' (or something) and then just reference this in the template.

Boring but it works I guess.


All times are GMT -8. The time now is 04:44 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.