X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   make "save x%" icon conditional? (https://forum.x-cart.com/showthread.php?t=3870)

jfreed 08-04-2003 08:45 AM

make "save x%" icon conditional?
 
I like the "save x%" in the product list and the nice icon on the detail page. It looks lame, however, when there is no discount!!

I wonder if anyone has made a fix to make that conditional?

While your at it, I'd like to be able to show Marketprice crossed out on product detail pages too.

I find smartys to be incredibly painful -- it's like learning *another* language and I've barely got html figured out.
:?


Environment components info:
Component Status б═
X-Cart version 3.4.4 б═
PHP 4.3.2 details >>
Console PHP (cli) 4.1.2 б═
MySQL server 3.23.56 б═
Web server Apache б═
Operation system Linux б═
Perl 5.006001 details >>
Net::SSLeay not found б═
libCURL not found б═
CURL executable curl 7.9.5 (i386-redhat-linux-gnu) libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled) б═
Magic quotes (magic_quotes_gpc) enabled

shan 08-04-2003 08:53 AM

It shouldnt show when there is no discount anyway

jfreed 08-04-2003 09:11 AM

maybe it *shouldn't* but....
 
Here is an example:

http://www.6seconds.org/xcart/customer/product.php?productid=66&cat=1&page=1


Maybe there is a template I messed up?? But I did almost nothing to templates ('cause like I said, smartys just kills me)
-J

shan 08-04-2003 09:20 AM

look at skin1/customer/product.tpl

there may be a problem there. try and restore the template

jfreed 08-04-2003 09:34 AM

no love
 
I had not changed, but re-uploaded anyway, and no dif.

I see in the template the part that should be doing this if:

Quote:

{if $product.list_price gt 0}<table border=0 width=60><tr><td width=55 height=56 class="SaveMoneyLabel" background="{$ImagesDir}/save_money.gif" align=center valign=middle>


{math equation="100-(price/lprice)*100" price=$product.price lprice=$product.list_price format="%d" assign=discount}
{ $discount }%
</td></tr></table>{/if}

But it does not look like it checks to see if price<lprice....

The only template I changed is "powered by" -- I tried changing the help menu too, but failed...

ocabj 08-08-2003 05:32 AM

I also want to get rid of the "Save 0%" icon in the Product Details listing. X-Cart still displays it if there is no discount.

shan 08-08-2003 06:13 AM

Did you fill in both market price and price.

If they are the same then it will show o% discount

Just fill in your price and NOT market price if there is no discount

ocabj 08-08-2003 07:58 AM

Ah, thanks for the tip. Looks good now.

jfreed 08-08-2003 08:20 AM

Yea! :D
 
That worked for me too!!!

I guess I could have thought of trying that -- somehow not obvious to me.
:oops:


Thanks for the help!

slimmedia 08-08-2003 11:39 AM

This has been a peeve of mine in the way x-cart works for a long time. The way x-cart does pricing makes a lot of sense for a store that offers all of it's products at a discount off of retail prices. It doesn't make much sense for a store that sets its own regular prices, and occasionally puts things on sale.

Even if you make edits to the languages variables, there are still stupid things like it displaying a 0% discount.

Let's say you have an item setup with the regular price of $25.00 inputted as the price, and you leave the list price blank (0.00). Everything looks fine.

Then you want to put it on sale. You go to the admin area, go to "modify product" and you do a search. The product appears in a list, possibly with others. It shows that the "list price" is $25.00 and "your price" is $25.00. So far so good. It has a nice text box for you to edit the "your price" so that you don't have to go two clicks further to the modify product screen. This is especially nice if you want to put a number of products on sale.

So, you change the "your price" to $20.00 and hit "update". Now the "your price" is $20.00 :D, but the "list price" is also $20.00 :(. So then you have to go into the modify screen for that product and input the list price of $25.00. Now everything's fixed, just the way you wanted it: It's list price is $25.00, it's price is $20.00 it shows that it's at a 20% discount :).

So then you want to take the product off sale, back to regular price. You go to the modify product area, do a search, change the price back to $25.00 and click update. Now the list price is $25.00 and the price is $25.00 :), but it shows that the product has a 0% discount :x. So again, you have to go into the individual product's information to change the list price back to 0.00 (or blank).

After dealing with this for a while, I took matters into my own hands. I set all my prices to have the same "list price" as the "price" then I made it display the way I want by editing the templates. Now I can go and put a bunch of products on sale right from the search page.

In order to make it work I made changes to '/skin1/customer/main/products.tpl'. I replaced the pricing logic with the following:

Code:

{if $products[product].price ne 0}
{if $products[product].list_price ne $products[product].price and $products[product].list_price gt 0}
{math equation="100-(price/lprice)*100" price=$products[product].price lprice=$products[product].list_price format="%d" assign=discount}
<font class="MarketPrice">{$lng.lbl_market_price}: <s>{include file="currency.tpl" value=$products[product].list_price}</s></font>

<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font> (save {$discount}%)
{else}
<font class="ProductPrice">{include file="currency.tpl" value=$products[product].price}</font>
{/if}
{if $config.Taxes.use_vat eq "Y" and $products[product].vat gt "0"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if}


{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>


{/if}
{/if}


I also used the same logic in '/skin1/customer/main/product.tpl' to make sure that the "save money" graphic didn't display showing a 0% discount.

Product on sale BEFORE :) :
Quote:

Regular price: $25.00
Now: $20.00 (save 20%)

Product at regular price BEFORE :( :
Quote:

Regular price: $25.00
Now: $25.00 (save 0%)

Product on sale AFTER :) :
Quote:

Regular price: $25.00
Now: $20.00 (save 20%)

Product at regular price AFTER :D :
Quote:

$25.00


All times are GMT -8. The time now is 03:16 PM.

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