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)
-   -   product_prices.tpl for wholesale prices - won't edit (https://forum.x-cart.com/showthread.php?t=54964)

Sisom 08-08-2010 08:10 AM

product_prices.tpl for wholesale prices - won't edit
 
Hi, I've been trying to change the colors on the wholesale prices on the product pages, but I've come across something very strange - part of the code in customer/main/product_prices.tpl is outputting HTML, but the other part just doesn't seem to do anything.

My product_prices.tpl looks like this:
Code:

{*
$Id: product_prices.tpl,v 1.23.2.1 2010/02/25 11:15:18 aim Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
<div id="wl-prices"{if !$product_wholesale} style="display: none;"{/if}>

  {if $product.taxes}
    {capture name=taxdata}
      {include file="customer/main/taxed_price.tpl" taxes=$product.taxes display_info="N"}
    {/capture}
  {/if}

  <table cellspacing="1" summary="{$lng.lbl_wholesale_prices|escape}">

    <tr class="head-row">
      <th>{$lng.lbl_quantity}</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}</th>
    </tr>

    {foreach from=$product_wholesale item=w name=wi}
      <tr class="wholesale">
        <td>
          {strip}
          {$w.quantity}{if $w.next_quantity eq 0}+{elseif $w.next_quantity ne $w.quantity}-{$w.next_quantity}{/if}
          &nbsp;
          {$lng.lbl_item}{if $w.quantity > 1}s{/if}
          {* COMMENTING OUT X-CART PLURAL CODE *}
          {* {if $w.quantity eq "1"}
            {$lng.lbl_item}
          {else}
            {$lng.lbl_items}
          {/if} *}
          {* COMMENTING OUT X-CART PLURAL CODE --->END *}
          {/strip}
        </td>
        <td>{include file="currency.tpl" value=$w.taxed_price tag_id="wp`$smarty.foreach.wi.index`"}</td>
      </tr>
    {/foreach}

  </table>

  <div{if !$smarty.capture.taxdata} style="display: none;"{/if}>
    <strong>*{$lng.txt_note}:</strong>{$smarty.capture.taxdata}
  </div>

</div>


You can see that I thought I'd do an experiment to make the automatic insertion of 's' for plural items, a little shorter code-wise, but then I decided to add a class to the second table row, and use a descendant selector to modify the table cells. But it doesn't work. The class doesn't show up when I view the site in my browser, and check the source HTML.
But the code in the table header DOES work. If I insert the word 'test' as follows:
Code:

<tr class="head-row">
      <th>{$lng.lbl_quantity}TEST</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}TEST</th>
    </tr>

it appears in the browser, but no matter what I do to the next table row (including completely commenting out all of the following piece of code), it still appears exactly the same!
Code:

{foreach from=$product_wholesale item=w name=wi}
      <tr class="wholesale">
        <td>
          {strip}
          {$w.quantity}{if $w.next_quantity eq 0}+{elseif $w.next_quantity ne $w.quantity}-{$w.next_quantity}{/if}
          &nbsp;
          {$lng.lbl_item}{if $w.quantity > 1}s{/if}
          {* COMMENTING OUT X-CART PLURAL CODE *}
          {* {if $w.quantity eq "1"}
            {$lng.lbl_item}
          {else}
            {$lng.lbl_items}
          {/if} *}
          {* COMMENTING OUT X-CART PLURAL CODE --->END *}
          {/strip}
        </td>
        <td>{include file="currency.tpl" value=$w.taxed_price tag_id="wp`$smarty.foreach.wi.index`"}</td>
      </tr>
    {/foreach}


Even when I commented out all of that code, it still displays in the browser, but I can't work out how!

Does anybody have any ideas? It's hard enough trying to edit things, without them refusing to change after being edited!

You can see what it looks like on the product page for 'Test product' here:

http://www.mrdtrading.co.uk/store/home.php?shopkey=martin

Many thanks.

Sisom 08-08-2010 08:17 AM

Re: product_prices.tpl for wholesale prices - won't edit
 
I've also tried the following:
Code:

{*
$Id: product_prices.tpl,v 1.23.2.1 2010/02/25 11:15:18 aim Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
<div id="wl-prices"{if !$product_wholesale} style="display: none;"{/if}>

  {if $product.taxes}
    {capture name=taxdata}
      {include file="customer/main/taxed_price.tpl" taxes=$product.taxes display_info="N"}
    {/capture}
  {/if}

  <table cellspacing="1" summary="{$lng.lbl_wholesale_prices|escape}">

  {* <tr class="head-row">
      <th>{$lng.lbl_quantity}</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}</th>
    </tr> *}



  </table>

  <div{if !$smarty.capture.taxdata} style="display: none;"{/if}>
    <strong>*{$lng.txt_note}:</strong>{$smarty.capture.taxdata}
  </div>

</div>


This makes the browser display two rows of the bottom row, i.e. it now displays:
10+ Items ё49.99
10+ Items ё49.99

So obviously it must be getting the table row (not the table header) from somewhere else.

I even tried inserting the following:
Code:

    <tr class="head-row">
      <th>{$lng.lbl_quantity}</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}</th>
    </tr>

<tr><td>TEST</td></tr>


But it wouldn't display the 'TEST', it just didn't exist in the HTML source.

Shamun 08-08-2010 09:06 AM

Re: product_prices.tpl for wholesale prices - won't edit
 
Try running www.yoursite.com/cleanup.php to clear the cache.

Sisom 08-08-2010 10:35 AM

Re: product_prices.tpl for wholesale prices - won't edit
 
I tried that Tal, but no luck. I have just edited customer/main/send_to_friend.tpl and it worked fine, so I can't understand why product_prices.tpl isn't doing what I tell it to!

I have just tried reducing it down to:
Code:

{*
$Id: product_prices.tpl,v 1.23.2.1 2010/02/25 11:15:18 aim Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
<div id="wl-prices"{if !$product_wholesale} style="display: none;"{/if}>

  {if $product.taxes}
    {capture name=taxdata}
      {include file="customer/main/taxed_price.tpl" taxes=$product.taxes display_info="N"}
    {/capture}
  {/if}

  <table cellspacing="1" summary="{$lng.lbl_wholesale_prices|escape}">

    <tr class="head-row">
      <th>{$lng.lbl_quantity}</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}</th>
    </tr>


  </table>

  <div{if !$smarty.capture.taxdata} style="display: none;"{/if}>
    <strong>*{$lng.txt_note}:</strong>{$smarty.capture.taxdata}
  </div>

</div>


and yet it still displays the table row, meaning nothing that I deleted could have been displaying it. I just don't get it.

Also, the wholesale prices header has never appeared, I presume it should be at the head of the table, due to:
Code:

<table cellspacing="1" summary="{$lng.lbl_wholesale_prices|escape}">

Sisom 08-08-2010 10:40 AM

Re: product_prices.tpl for wholesale prices - won't edit
 
I also tried deleting the whole table, and that worked - i.e. the wholesale prices table completely vanished:

Code:

{*
$Id: product_prices.tpl,v 1.23.2.1 2010/02/25 11:15:18 aim Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
<div id="wl-prices"{if !$product_wholesale} style="display: none;"{/if}>

  {if $product.taxes}
    {capture name=taxdata}
      {include file="customer/main/taxed_price.tpl" taxes=$product.taxes display_info="N"}
    {/capture}
  {/if}



  <div{if !$smarty.capture.taxdata} style="display: none;"{/if}>
    <strong>*{$lng.txt_note}:</strong>{$smarty.capture.taxdata}
  </div>

</div>


So somehow, the following piece of code doesn't actually do anything, even though it must!
Code:

  {foreach from=$product_wholesale item=w name=wi}
      <tr class="wholesale">
        <td>
          {strip}
          {$w.quantity}{if $w.next_quantity eq 0}+{elseif $w.next_quantity ne $w.quantity}-{$w.next_quantity}{/if}
          &nbsp;
          {$lng.lbl_item}{if $w.quantity > 1}s{/if}
          {* COMMENTING OUT X-CART PLURAL CODE *}
          {* {if $w.quantity eq "1"}
            {$lng.lbl_item}
          {else}
            {$lng.lbl_items}
          {/if} *}
          {* COMMENTING OUT X-CART PLURAL CODE --->END *}
          {/strip}
        </td>
        <td>{include file="currency.tpl" value=$w.taxed_price tag_id="wp`$smarty.foreach.wi.index`"}</td>
      </tr>
    {/foreach} 


I know it must be doing something, because when I remove the following piece of code only, the table head row, I see two versions of the table data cells, one on top of the other:
Code:

    <tr class="head-row">
      <th>{$lng.lbl_quantity}</th>
      <th>{$lng.lbl_price}{if $smarty.capture.taxdata}*{/if}</th>
    </tr>


This is a real head scratcher for me.

pauldodman 03-13-2012 06:30 AM

Re: product_prices.tpl for wholesale prices - won't edit
 
Just in case anyone else gets stuck with this - the table is actually built up in Product_Options/func.js

Ben G 09-08-2014 06:17 PM

Re: product_prices.tpl for wholesale prices - won't edit
 
pauldodman is correct.

The following post might help some understand a little more how Product_Options/func.js and product_prices.tpl work together.
http://forum.x-cart.com/showthread.php?p=377050#post377050


All times are GMT -8. The time now is 05:19 PM.

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