MichaelP Posted November 3, 2012 Share Posted November 3, 2012 (edited) Hello, I have a module "homenewproduct" with the following code where I would like a button based on whether the product is an "online only" product. This code works on the product page {if $product->online_only} <p id="button_go_to_shop"> <a href="{$product->location}" target="_blank" class="exclusives" />{l s='only_online'}</a> </p> {/if} andthis on the product-list {if isset($product.online_only) && $product.online_only}<span class="online_only"><p id="button_go_to_shop_mini"><a href="{$product.location}" target="_blank" class="exclusives" />{l s='Online only!'}</a></p></span>{/if} But how do I get the following codes adapted so that it works in the following code, and so I get a button like on the product to the right "look at attach screenshot" {* * 2007-2010 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author Prestashop SA <[email protected]> * @copyright 2007-2010 Prestashop SA * @version Release: $Revision: 1.4 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- MODULE Home Featured Products --> <div id="featured-products_block_center" class="block products_block"> <h4>{l s='New products' mod='homenewproducts'}</h4> {if isset($new_products) AND $new_products} <div class="block_content"> {assign var='liHeight' value=800} {assign var='nbItemsPerLine' value=4} {assign var='nbLi' value=$new_products|@count} {assign var='nbLines' value=($nbLi/$nbItemsPerLine)|ceil} {assign var='ulHeight' value=$nbLines*$liHeight} <ul style="height:{$ulHeight}px;" > {foreach from=$new_products item=product name=newProducts} <li class="ajax_block_product {if $smarty.foreach.newProducts.first}first_item{elseif $smarty.foreach.newProducts.last}last_item{else}item{/if} {if $smarty.foreach.newProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.newProducts.iteration%$nbItemsPerLine == 1}clear{/if} {if $smarty.foreach.newProducts.iteration > ($smarty.foreach.newProducts.total - ($smarty.foreach.newProducts.total % $nbItemsPerLine))}last_line{/if}"> <h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}</a></h5> <div class="product_desc"><a href="{$product.link}" title="{l s='More' mod='homefeatured'}"></a></div> <a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /></a> <p id="button_go_to_shop"> {if $product->online_only} <p id="button_go_to_shop"> <a href="{$product->location}" target="_blank" class="exclusives" />{l s='only_online'}</a> </p> {/if} </p> <div> {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if} {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2} <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Tilføj kurv' mod='homefeatured'}</a> {else} <span class="exclusive">{l s='Add to cart' mod='homefeatured'}</span> {/if} {else} <div style="height:23px;"></div> {/if} </div> </li> {/foreach} </ul> </div> {else} <p>{l s='No new products at this time' mod='blocknewproducts'}</p> {/if} </div> <!-- /MODULE Home Featured Products --> Edited November 3, 2012 by MichaelP (see edit history) Link to comment Share on other sites More sharing options...
MichaelP Posted November 3, 2012 Author Share Posted November 3, 2012 isn't there someone who has an idea of how it can be solved thx Michael Link to comment Share on other sites More sharing options...
Recommended Posts