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)
-   -   Adding Buy Now & Wishlist Buttons - Main Prod Template (https://forum.x-cart.com/showthread.php?t=64773)

thelilypad 09-04-2012 06:52 PM

Adding Buy Now & Wishlist Buttons - Main Prod Template
 
I am trying to dig up where these would have been commented out in my customer/main/products_t.tpl; however there is no commenting out of any kind - they appear to be missing altogether.

What code do I need to add these again and where in the template would it go? I have tried to search the forums for the code but haven't been successful as of yet.

Thanks.

totaltec 09-04-2012 09:33 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
X-cart 4.2.2
/customer/main/products_t.tpl
PHP Code:

{*
$Idproducts_t.tpl,v 1.46 2008/12/10 08:29:52 max Exp $
vimset ts=2 sw=2 sts=2 et:
*}
{
list2matrix assign="products_matrix" assign_width="cell_width" list=$products row_length=$config.Appearance.products_per_row}
{
assign var="is_matrix_view" value=true}
{if 
$products_matrix}
  <
table cellspacing="0" class="products products-table width-100" summary="{$lng.lbl_products_list|escape}">
    {foreach 
from=$products_matrix item=row name=products_matrix}
      <
tr{if !$smarty.foreach.products_matrix.first} class="products-row"{/if}>
        {foreach 
from=$row item=product}
          {if 
$product}
            <
td class="product-cell" style="width: {$cell_width}%;">
              <
a href="product.php?productid={$product.productid}&cat={$cat}&page={$navigation_page}class="product-title">{$product.product|escape}</a>
              {if 
$config.Appearance.display_productcode_in_list eq "Y" && $product.productcode}
                <
div class="sku">{$lng.lbl_sku}: {$product.productcode|escape}</div>
              {/if}
            </
td>
          {/if}
        {/foreach}
      </
tr>
      <
tr>
        {foreach 
from=$row item=product}
          {if 
$product}
            <
td class="product-cell">
              <
div class="image">
                <
a href="product.php?productid={$product.productid}&cat={$cat}&page={$navigation_page}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a>
                {if 
$active_modules.Special_Offers && $product.have_offers}
                  {include 
file="modules/Special_Offers/customer/product_offer_thumb.tpl"}
                {/if}
              </
div>
            </
td>
          {/if}
        {/foreach}
      </
tr>
      <
tr>
        {foreach 
from=$row item=product}
          {if 
$product}
            <
td class="product-cell">
                <
a href="product.php?productid={$product.productid}&cat={$cat}&page={$navigation_page}class="see-details">{$lng.lbl_see_details}</a>
              {if 
$active_modules.Feature_Comparison && $product.fclassid gt 0}
                <
div align="center">{include file="modules/Feature_Comparison/compare_checkbox.tpl" id=$product.productid}</div>
              {/if}
            </
td>
          {/if}
        {/foreach}
      </
tr>
      <
tr>
        {foreach 
from=$row item=product}
          {if 
$product}
            <
td class="product-cell product-cell-price">
              {if 
$product.product_type ne "C"}
                {if 
$active_modules.Subscriptions ne "" && $product.catalogprice}
                  {include 
file="modules/Subscriptions/subscription_info_inlist.tpl"}
                {elseif 
$product.appearance.is_auction}
                  <
span class="price">{$lng.lbl_enter_your_price}</span><br />
                  {
$lng.lbl_enter_your_price_note}
                {else}
                  {if 
$product.appearance.has_price}
                    <
div class="price-row">
                      <
span class="price">{$lng.lbl_our_price}:</span> <span class="price-value">{include file="currency.tpl" value=$product.taxed_price}</span>
                      <
span class="market-price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price}</span>
                    </
div>
                    {if 
$product.appearance.has_market_price && $product.appearance.market_price_discount gt 0}
                      <
div class="market-price">
                        {
$lng.lbl_market_price}: <span class="market-price-value">{include file="currency.tpl" value=$product.list_price}</span>
                        {if 
$product.appearance.market_price_discount gt 0}
                          {if 
$config.General.alter_currency_symbol ne ""}, {/if}
                          <
class="price-save">{$product.appearance.market_price_discount}% {$lng.lbl_save_price}</p>
                        {/if}
                      </
div>
                    {/if}
                    {if 
$product.taxes}
                      <
div class="taxes">{include file="customer/main/taxed_price.tpl" taxes=$product.taxes is_subtax=true}</div>
                    {/if}
                  {/if}
                  {if 
$active_modules.Special_Offers && $product.use_special_price}
                    {include 
file="modules/Special_Offers/customer/product_special_price.tpl"}
                  {/if}
                {/if}
              {else}
 
              {/if}
            </
td>
          {/if}
        {/foreach}
      </
tr>
      <
tr>
        {foreach 
from=$row item=product}
          {if 
$product}
            <
td class="product-cell product-cell-buynow">
                {if 
$config.Appearance.buynow_button_enabled eq "Y"}
                  {include 
file="customer/main/buy_now.tpl"}
                {else}
 
                {/if}
            </
td>
          {/if}
        {/foreach}
      </
tr>
    {/foreach}
  </
table>
{/if} 

The important bit is :
{include file="customer/main/buy_now.tpl"}

thelilypad 09-04-2012 09:49 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
excellent work! thanks.

now to remove the quantities and modify a bit more. assuming that to remove qtys it requires the buy_now.tpl?

totaltec 09-04-2012 09:57 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
Yes the quantity input is controlled by the buy now template. Just remove the input boxes/selects and replace with : <input type="hidden" name="amount" value="1" /> or whatever amount value you want to default to.

thelilypad 09-04-2012 10:13 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
i think i edited a bit too much because only the first row of products would work correctly in the add to wish list..

this is the my original shortened a bit at the top...

Quote:


<div class="buy-now">
{if $product.price eq 0 && ($active_modules.Special_Offers ne "Y" || $product.use_special_price eq '')}
{assign var="button_href" value=$smarty.get.page|escape:"html"}
{if $is_matrix_view}
<div class="quantity-empty"></div>
{/if}
<form action="product.php" method="get" name="buynowform{$product.productid}">
<input type="hidden" name="productid" value="{$product.productid}" />
<input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}" />
<input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}" />
<div class="center">
<div class="halign-center">
{include file="customer/buttons/buy_now.tpl" additional_button_class="main-button" type="input}
</div>
</div>
</form>
{else}
{if $product.appearance.buy_now_cart_enabled}
{if $product.appearance.force_1_amount}
{if $is_matrix_view}
<div class="quantity-empty"></div>
{/if}
<input type="hidden" name="amount" value="1" />
{else}
<div class="quantity" {if $product.quantity_input_box_enabled && $config.Appearance.products_per_row && ($featured eq "Y" || $config.Appearance.featured_only_multicolumn eq "N")}style="height: 40px;"{/if}>
<span class="quantity-title">{$lng.lbl_quantity}</span>
{if $product.appearance.empty_stock}
<span class="out-of-stock">{$lng.txt_out_of_stock}</span>
{else}
{if $product.quantity_input_box_enabled}
<input type="text" id="product_avail_{$product.productid}" name="amount" maxlength="11" size="6" onchange="javascript: return check_quantity('{$product.productid}', '{$product.appearance.min_quantity}', '{$product.avail}');" value="{$product.appearance.min_quantity|default:" 1"}"/>
<br />
{$lng.lbl_product_quantity_type_error|substitute:" min":$product.appearance.min_quantity:"max":$produ ct.avail}

{else}

<select name="amount">
{section name=quantity loop=$product.appearance.loop_quantity start=$product.appearance.min_quantity}
<option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>
{/if}
{/if}
</div>
{/if}

{elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" && $product.catalogprice) && $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && !$product.variantid}
<div class="quantity"><strong>{$lng.txt_out_of_stock}</strong></div>
{elseif $is_matrix_view}
<div class="quantity-empty"></div>
{else}
<br />
{/if}
{if $product.appearance.buy_now_buttons_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<div class="button-row">
{include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}
</div>
{elseif $js_enabled}
{if $is_matrix_view}
<div class="button-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
</div>
{if $active_modules.Wishlist && ($config.Wishlist.add2wl_unlogged_user eq "Y" || $login ne "")}
<div class="button-row">
{include file="customer/buttons/add_to_wishlist.tpl" href="javascript: submitForm(document.orderform_`$product.productid` _`$product.add_date`, 'add2wl'); return false;"}
</div>
{/if}
{else}
<div class="buttons-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
{if $active_modules.Wishlist && ($config.Wishlist.add2wl_unlogged_user eq "Y" || $login ne "")}
<div class="button-separator"></div>
{include file="customer/buttons/add_to_wishlist.tpl" href="javascript: submitForm(document.orderform_`$product.productid` _`$product.add_date`, 'add2wl'); return false;"}
{/if}
</div>
<div class="clearing"></div>
{/if}
{else}
<div class="button-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
</div>
{/if}
{/if}
{if $product.min_amount gt 1}
<div class="product-details-title">{$lng.txt_need_min_amount|substitute:"items ":$product.min_amount}</div>
{/if}
{/if}
</div>
{if $product.appearance.buy_now_form_enabled}
</form>
{/if}





and the modified

Quote:

{*
$Id: buy_now.tpl,v 1.1.2.127 2009/06/24 13:22:18 aim Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $product.appearance.buy_now_form_enabled}
<form name="orderform_{$product.productid}_{$product.add _date}" method="{if $product.appearance.buy_now_cart_enabled}post{else }get{/if}" action="{if $product.appearance.buy_now_cart_enabled}cart.php{ else}product.php{/if}" {if $product.quantity_input_box_enabled}onsubmit="java script: return check_quantity('{$product.productid}', '{$product.appearance.min_quantity}', '{$product.avail}');"{/if}>
<input type="hidden" name="mode" value="add" />
<input type="hidden" name="productid" value="{$product.productid}" />
<input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}" />
<input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}" />
{/if}
<div class="buy-now">
{if $product.price eq 0 && ($active_modules.Special_Offers ne "Y" || $product.use_special_price eq '')}
{assign var="button_href" value=$smarty.get.page|escape:"html"}
{if $is_matrix_view}
<div class="quantity-empty"></div>
{/if}
<form action="product.php" method="get" name="buynowform{$product.productid}">
<input type="hidden" name="productid" value="{$product.productid}" />
<input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}" />
<input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}" />
<div class="center">
<div class="halign-center">
{include file="customer/buttons/buy_now.tpl" additional_button_class="main-button" type="input}
</div>
</div>
</form>
{else}
{if $product.appearance.buy_now_cart_enabled}
<input type="hidden" name="amount" value="1" />
{/if}

{elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" && $product.catalogprice) && $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && !$product.variantid}
<div class="quantity"><strong>{$lng.txt_out_of_stock}</strong></div>
{elseif $is_matrix_view}
<div class="quantity-empty"></div>
{else}
<br />
{/if}
{if $product.appearance.buy_now_buttons_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<div class="button-row">
{include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}
</div>
{elseif $js_enabled}
{if $is_matrix_view}
<div class="button-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
</div>
{if $active_modules.Wishlist && ($config.Wishlist.add2wl_unlogged_user eq "Y" || $login ne "")}
<div class="button-row">
{include file="customer/buttons/add_to_wishlist.tpl" href="javascript: submitForm(document.orderform_`$product.productid` _`$product.add_date`, 'add2wl'); return false;"}
</div>
{/if}
{else}
<div class="buttons-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
{if $active_modules.Wishlist && ($config.Wishlist.add2wl_unlogged_user eq "Y" || $login ne "")}
<div class="button-separator"></div>
{include file="customer/buttons/add_to_wishlist.tpl" href="javascript: submitForm(document.orderform_`$product.productid` _`$product.add_date`, 'add2wl'); return false;"}
{/if}
</div>
<div class="clearing"></div>
{/if}
{else}
<div class="button-row">
{include file="customer/buttons/buy_now.tpl" type="input" additional_button_class="main-button"}
</div>
{/if}
{/if}
{if $product.min_amount gt 1}
<div class="product-details-title">{$lng.txt_need_min_amount|substitute:"items ":$product.min_amount}</div>
{/if}
{/if}
</div>
{if $product.appearance.buy_now_form_enabled}
</form>
{/if}





did i get that right this time?

totaltec 09-04-2012 10:30 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
Honestly it's too much to read through and figure out at the moment. If it only works on the first row, you know you have messed up the association between rows. In this case you always refer to your backups, which I realize you may not have.

I would download a fresh copy of 4.2.2, if it is not available in your helpdesk, request it from QT. Then start over with a renewed respect for the template's structure. Hope that helps, best I could muster. :-)

thelilypad 09-04-2012 10:33 PM

Re: Adding Buy Now & Wishlist Buttons - Main Prod Template
 
thanks! i may have also been delete happy. i will refresh and try again. always try to keep backups filed away.


All times are GMT -8. The time now is 02:38 AM.

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