Jump to content

Ukrycie za pomocą hidden lub innym kodem


Recommended Posts

W pliku szablonu product.tpl, chciałbym wprowadzić jedną zmianę. To znaczy, chciałem dodać kod, dzięki któremu, jeśli cena = 0, to nie wyświetli się cena i przycisk dodaj do koszyka, będzie po prostu jakoś schowany.
Poniżej załączam wycinek pliku tpl odpowiedzialny za wyswietlanie ceny i proszę o pomoc. Co i jak dodać, w razie czego cały plik wyślę jakoś na pw, bo tu nie moge wkleic (jest za długi)

 

<div class="product_price">
                <!-- prices -->
     {if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
    
        
     <p class="our_price_display" {if $enable_google_rich_snippets} itemtype="http://schema.org/Offer" itemscope="" itemprop="offers" {/if}>
     {if $priceDisplay >= 0 && $priceDisplay <= 2}
     <span id="our_price_display" {if $enable_google_rich_snippets} itemprop="price" {/if}>{convertPrice price=$productPrice}</span>
     {if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label)) && (isset($sttheme.display_tax_label) && $sttheme.display_tax_label)}
     <span class="product_tax_label">{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}</span>
     {/if}
     {/if}
     </p>
    
     
     {if $priceDisplay == 2}
     <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
     {/if}
                    
                <p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display" class="sale_percentage">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>
     <p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>
     <span id="reduction_amount_display" class="sale_percentage">
     {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}
     -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}
     {/if}
     </span>
     </p>
                <p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>
     {if $priceDisplay >= 0 && $priceDisplay <= 2}
     <span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
     <!-- {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if} -->
     {/if}
     </p>
                
                <div class="clearit mar_b10" ></div>                
     {if $packItems|@count && $productPrice < $product->getNoPackPrice()}
     <p class="pack_price">{l s='Instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
     <br class="clear" />
     {/if}
     {if $product->ecotax != 0}
     <p class="price-ecotax">{l s='Include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='For green tax'}
     {if $product->specificPrice AND $product->specificPrice.reduction}
     <br />{l s='(not impacted by the discount)'}
     {/if}
     </p>
     {/if}
     {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
      {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
     <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
     {/if}
     {if $product->online_only}
     <p class="online_only">{l s='Online only'}</p>
     {/if}
     {*close if for show price*}
     {/if}
            </div>
Edited by brt00 (see edit history)
Link to comment
Share on other sites

<p class="{if $productPrice==0}hidden{/if} our_price_display" {if $enable_google_rich_snippets} itemtype="http://schema.org/Offer" itemscope="" itemprop="offers" {/if}>
    {if $priceDisplay >= 0 && $priceDisplay <= 2}
    <span id="our_price_display" {if $enable_google_rich_snippets} itemprop="price" {/if}>{convertPrice price=$productPrice}</span>
    {if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label)) && (isset($sttheme.display_tax_label) && $sttheme.display_tax_label)}
    <span class="product_tax_label">{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}</span>
    {/if}
    {/if}
</p>

spróbuj z tym kodem powyżej, nie sprawdzałem czy działa - ale powinien ;)

Link to comment
Share on other sites

×
×
  • Create New...