24230

Prestashop 1.6. How to check if product isPack in .tpl?

Question:

I want to check in theme (front) <strong>product.tpl</strong> file (PS 1.6.1.4) <strong><em>if state</em></strong> if product is <strong>Standard product</strong> or <strong>Pack of existing products</strong>

{if $product_type == Product::PTYPE_PACK} not working....

I want to return <strong>boolean</strong>.

Answer1:

use:

{if $packItems|@count > 0}

an example of using you can find it in product.tpl in the theme folder. used in this way:

{if $packItems|@count > 0} <div class="short_description_pack"> <h3>{l s='Pack content'}</h3> {foreach from=$packItems item=packItem} <div class="pack_content"> {$packItem.pack_quantity} x <a href="{$link->getProductLink($packItem.id_product, $packItem.link_rewrite, $packItem.category)|escape:'html':'UTF-8'}">{$packItem.name|escape:'html':'UTF-8'}</a>

{$packItem.description_short}

</div> {/foreach} </div> {/if}

Answer2:

in addition, there is in a products object:

$product->id_pack_product_attribute = null $product->cache_is_pack = 0

for non-pack products

Recommend

  • Django Forms Validation message not showing
  • Adding Product Programmatically in woocommerce
  • Adding product type in prestashop add product page
  • Convert XML to CSV with PHP, with different fields in some itens
  • Shopify API CARTS - Changing line_item line_price for price Override
  • How can I make a 100% stacked chart with nvd3?
  • Returning the auto incrementing value after an insert using slick
  • Magento get URL before current
  • Sending HTML Form Data to Spring REST Web Service
  • How can I extract results of aggregate queries in slick?
  • OOP Javascript - Is “get property” method necessary?
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Paperclip, set path outside of rails root folder
  • PHP - How to update data to MySQL when click a radio button
  • XCode can't find symbols for a specific iOS library/framework project
  • Matrix multiplication with MKL
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Hits per day in Google Big Query
  • Trying to get generic when generic is not available
  • Getting Messege Twice Using IMvxMessenger
  • embed rChart in Markdown
  • File not found error Google Drive API
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I remove ASP.NET Designer.cs files?
  • Bitwise OR returns boolean when one of operands is nil
  • python draw pie shapes with colour filled
  • Append folder name and increment by 1 using batch script
  • Is there any way to bind data to data.frame by some index?
  • Django query for large number of relationships
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Converting MP3 duration time
  • java string with new operator and a literal
  • How to push additional view controllers onto NavigationController but keep the TabBar?