View Single Post
  #4  
Old 10-07-2007, 09:20 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Free Gifts Module for x-cart v4.1.8

...continued from previous post

STEP 10
To make sure that the quantity input field doesn't show up if it's a free gift, we have to modify the skin1/customer/main/cart.tpl file
findthis code
Code:
<font class="ProductPriceConverting">{include file="currency.tpl" value=$price} x {if $active_modules.Egoods and $products[product].distribution}1<input type="hidden"{else}<input type="text" size="3"{/if} name="productindexes[{$products[product].cartid}]" value="{$products[product].amount}" /> = </font><font class="ProductPrice">{math equation="price*amount" price=$price amount=$products[product].amount format="%.2f" assign=unformatted}{include file="currency.tpl" value=$unformatted}</font><font class="MarketPrice"> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$unformatted}</font>
and replace with
Code:
{assign var="isFreeGift" value="0"} {section name=afg loop=$activeFreeGifts} {if $activeFreeGifts[afg].productid eq $products[product].productid} {assign var="isFreeGift" value="1"} {/if} {/section} {if $isFreeGift eq "1"} <font class="ProductDetailsTitle">1 - FREE!</font> {else} <font class="ProductPriceConverting">{include file="currency.tpl" value=$price} x {if $active_modules.Egoods and $products[product].distribution}1<input type="hidden"{else}<input type="text" size="3"{/if} name="productindexes[{$products[product].cartid}]" value="{$products[product].amount}" /> = </font><font class="ProductPrice">{math equation="price*amount" price=$price amount=$products[product].amount format="%.2f" assign=unformatted}{include file="currency.tpl" value=$unformatted}</font><font class="MarketPrice"> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$unformatted}</font> {/if}

END OF CODE

Whew....And that's it.

The last couple of days I started playing around with this code with no intentions of actually completing this project. But I got so involved in implementing this code for x-cart v4.1.8 I decided to complete all original 10 steps of the original post. This modification of mine is by no means complete. It's a starting point for others to continue adding, deleting or modifying. Although I have tested it and it's working great and have found no problems, I'm sure that many more things can be done to improve this mod for v4.1.8

Have fun.

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote