Prestashop custom link depending on product manufacturer - prestashop

I want to make a button with a modal effect on product page with ex. size table. I want to show only this size table depending on acutal product manufacturer.
Ex. Nike shoes
On product page (product.tpl file) button named like "size table". After use the button the modal popup box will show only the Nike shoe size table.
Maybe something like this should work?
{if $manufacutrer_name !='Nike'}
Size table
{/if}

Use the manufacturer id, you can do:
{if $product->id_manufacturer == 23}
Size table
{/if}

Related

prestashop where is subcategories query

Hello I am using menu for mobile for prestashop 1.6 website.
I want to shange displayed name of categories.
I created name2 field for ps_category_lang table and filled with shorter category names. I want to show short names af mobile menu.
{foreach $subcategories as $subcategory}
{if ($subcategory->id|escape:'htmlall':'UTF-8') ne '45'}
<li {if count($subcategory->getChildrenWs())}class="icon-arrow"{/if}>
<a
class="rm-level__item rm-category-{$subcategory->id|intval}"
{if $subcategory->nright > $subcategory->nleft +1}data-load="{$subcategory->id|escape:'htmlall':'UTF-8'}"{/if}
href="{$subcategory->getLink()|escape:'htmlall':'UTF-8'}"
>{$subcategory->name|escape:'htmlall':'UTF-8'}</a>
</li>
{/if}
when I change $subcategory->name to $subcategory->name2 menu shows empty category names.
https://addons.prestashop.com/en/mobile/17310-menu-for-mobile.html
where this subcategories created?
You also have to modify (preferably and most recommended, override) the Category.php (in classes) class and add the field name2 in the Lang fields definition of the model.

Prestashop 1.6 - Attachments from edit product tab in order detail dasboard

I need to add attachment (link to download directly) from product edit tab in order product list. This is not an attachment that customers add.
I edit: this theme (42 line) after product name, but it's not working.
{if isset($product.product_attachments) && $product.attachments->id}
<a href="{$link->getPageLink('attachment', true,
NULL,"id_attachment={$attachment.id_attachment}")|escape:'html':'UTF-8'}">attachment</a>
{/if}
Attachment file from eit product tab.
enter image description here
Prestashop 1.6
$product.product_attachments is not defined
$attachment is not defined
$product.attachments is not defined
You can get attachments of product using this:
Attachment::getAttachments($id_lang, $id_product);

Prestashop - out of stock list

I have a prestashop shop, when I sell t-shirts. Every t-shirt have several sizes (combinations), i.e. M, L, XL etc.
In blocklayered filter there are two filters: "Available" and "Out of stock" products, but they behave weirdly: "out of stock" filter shows products, that have 0 quantity in one/several sizes.
How can I modify this to show on "out of stock" list only products, that have no items available in ALL available sizes.
What I mean is when a t-shirt have 3 items in size M, but 0 in size L, I do not want it to show on "Out of stock" list.
The second thing is - how can I hide products, that are truly "out of stock" (no items in all combinations) from default category list page? What I want to achieve is that on category pages we have "Archive" tab, which should show products that used to be available in shop, but they are not anymore.
I use PS 1.6.1.9
Open www/themes/yourtheme/product-list (Dont forget to backup)
Search for
{assign var='nbLi' value=$products|#count}
Right below add
{foreach from=$products item=product name=products}
{if ($product.quantity <= 0)}
{$nbLi=$nbLi-1}
{/if}
{/foreach}
Search for
{foreach from=$products item=product name=products}
Right below add
{if ($product.quantity > 0)}
Search for
{/foreach}
Right above add
{/if}
Replace all instances of
$smarty.foreach.products.total
and
$smarty.foreach.products.iteration
with
$nbLi
This question was anwsered by MEG Venture in the prestashop forum.
https://www.prestashop.com/forums/topic/537182-disable-out-of-stock-product-from-listing-only/
There is a function in StockAvailable.php core class of PrestaShop that can be used to find the actual quantity of any option of a product.
StockAvailable::getQuantityAvailableByProduct()
You can simply run through a loop for every option of a product and find the quantity for all options and mark the product out of stock only if any option is not available.

Can I add the custom fields to the product listing page in BigCommerce

Each product has the custom fields options. Can I output those custom fields on each product item in the product list page? If so, how? I have tried adding the ProductOtherDetails and the %%SNIPPET_ProductCustomFieldItem%% in the CategoryProductsItem.html, but got no output at all of any of the items I have tried. Any suggestions or pointers on how and if this is possible?
As of September 2015, you can now access %%GLOBAL_ProductCustomFields%% on any template file that renders a particular panel's individual items. For example:
-Snippets/CategoryProductsItem.html for category list pages
-Snippets/HomeFeaturedProductsItem.html for the featured products panel
I recommend adding the custom field name as a class to each field for easy hiding, and accessing of the value in case the custom fields ever change you won't be accessing them via :nth-child CSS which would break. You can do so by modify Snippets/ProductCustomFieldItem.html to add the custom field name to the CSS class or ID like this:
<div class="DetailRow %%GLOBAL_CustomFieldName%%">
<div class="Label">%%GLOBAL_CustomFieldName%%:</div>
<div class="Value">
%%GLOBAL_CustomFieldValue%%
</div>
</div>​
Doing so, will output like this in each item in the category list.
Above, I am using the custom fields to send through shipping time, as well as "Starting At" to prepend to the list page price if the item is a parent which has children of higher prices. In my opinion, these features greatly increase the user experience.
For Faceted Search (handlebars.js)
I recommend adding this to Panels/FacetedSearchProductGrid.html:
{{#each product.custom_fields}}
{{ id }} : {{ name }} : {{ value }}
{{/each}}
Those filters will be limited to the Product pages specifically. The only way around it is to hash together a solution using jQuery to go and fetch items in question from the product page. A pain, but do-able with unnecessary effort.

Make a field invisible or readonly dynamically in Odoo 'Websites' (not in Form view)

In odoo 8 the website is generated from Qweb templates. The webpages can also contain fields (say like in the 'Contact Us' form).
In the normal Odoo Form view it is easy to make a field invisible or readonly dynamically based on the user entry in some other field.
How can the similar thing be done in the Website view?
You can use a t-if statement, wrapped around the field you want to hide. Something like:
<div t-if="o.company_id">
<span t-field="o.company_id.partner_id.name">
</div>
In this example, the "name" field will be hidden if "company_id" is not set.
Here's a link to the QWeb reference.
If you want to omit some fields on dynamic basis. You can use "t-if" in your template, When you print it QWEB.