sm5k Posted December 11, 2013 Share Posted December 11, 2013 Dear Community, i got a question on linking products. I try to describe as good as i can. Got a crossselling popup where some additional products are showed. See attached Screenshot plz. For each product shown in the popup the system allready gets the "Product Name". My Need is to link that Product Name to the Product Detail page. Any Ideas on how to do that. Thx a lot. SM5K PS: Prestashop 1.5.5 Link to comment Share on other sites More sharing options...
vekia Posted December 11, 2013 Share Posted December 11, 2013 what module you use exactly? can you please show module .tpl file? it will be much easier to give you correct code then Link to comment Share on other sites More sharing options...
sm5k Posted December 11, 2013 Author Share Posted December 11, 2013 Hey Vekia, thank you for the fast answer. I use the modalcrossselling modul. Frontend is using a file called popin.tpl Here is the code inside: _____________________________________________ {capture product_name assign=productName} {* short-hand *} {$product->name[$langId]} {if $hasCombination} {foreach $combination->getAttributesName($langId) as $attrubuteValue} {$attrubuteValue.name|strtolower} {/foreach} {/if}{/capture}<div class="js-modal-crossselling modal-crossselling"> {if $MC_DISPLAY_OVERLAY} <div class="{if $MC_OVERLAY_CLOSE}js-modal-crossselling__close {/if}modal-crossselling__overlay" style="background: {$MC_OVERLAY_BG_COLOR}; opacity: {$MC_OVERLAY_OPACITY / 100};" ></div> {/if} <div class="modal-crossselling__popin" style=" background: {$MC_POPIN_BG_COLOR}; width: {$MC_POPIN_WIDTH - $MC_POPIN_PADDING * 2}px; {if $MC_POPIN_FORCE_HEIGHT}height: {$MC_POPIN_HEIGHT - $MC_POPIN_PADDING * 2}px;{/if} padding: {$MC_POPIN_PADDING}px; margin-left: -{$MC_POPIN_WIDTH / 2}px; margin-top: -{$MC_POPIN_HEIGHT / 2}px; " > <div class="modal-crossselling__product-container" style=" background: {$MC_PRODUCT_CONTAINER_BG_COLOR}; margin-bottom: {$MC_PRODUCT_CS_SEPARATOR}px; border: 1px solid {$MC_PRODUCT_BD_COLOR}; border-radius: {$MC_PRODUCT_BD_RADIUS}px; padding: {$MC_PRODUCT_PADDING}px; " > <div class="modal-crossselling__product-title" style=" font-size: {$MC_TITLE_FONT_SIZE}px; line-height: {$MC_TITLE_FONT_SIZE}px; color: {$MC_TITLE_FONT_COLOR}; margin-bottom: {$MC_TITLE_SPACING}px; " > {if $quantity == 1} {sprintf($MC_TITLE_STR[$langId], $productName, $quantity, $total)} {else} {sprintf($MC_TITLE_PLR_STR[$langId], $productName, $quantity, $total)} {/if} </div> <img class="modal-crossselling__product-image" src="{$link->getImageLink($product->link_rewrite, $product->id_image, $MC_PRODUCT_IMAGE_FORMAT)}" alt="{$product->name[$langId]}" /> <div class="modal-crossselling__product-details" style=" font-size: {$MC_DTLS_FONT_SIZE}px; color: {$MC_DTLS_FONT_COLOR}; line-height: {$MC_DTLS_FONT_SIZE}px; margin-left: {$MC_DTLS_SPACING}px; " > {if $quantity == 1} {sprintf($MC_DTLS_STR[$langId], $productName, $quantity, $total)} {else} {sprintf($MC_DTLS_PLR_STR[$langId], $productName, $quantity, $total)} {/if} </div> </div> {if $crosssellingType != ModalCrossselling::CS_TYPE_NONE} <div class="modal-crossselling__cs-title" style=" font-size: {$MC_CS_TITLE_FONT_SIZE}px; line-height: {$MC_CS_TITLE_FONT_SIZE * 1.2}px; color: {$MC_CS_TITLE_FONT_COLOR}; " > {if $crosssellingType == ModalCrossselling::CS_TYPE_RELATED} {if count($crossSellingProducts) == 1} {$MC_CS_RELATED_TITLE_STR[$langId]} {else} {$MC_CS_RELATED_TITLE_PLR_STR[$langId]} {/if} {elseif $crosssellingType == ModalCrossselling::CS_TYPE_RECOMMANDATION} {if count($crossSellingProducts) == 1} {$MC_CS_RECO_TITLE_STR[$langId]} {else} {$MC_CS_RECO_TITLE_PLR_STR[$langId]} {/if} {elseif $crosssellingType == ModalCrossselling::CS_TYPE_CATEGORY} {if count($crossSellingProducts) == 1} {$MC_CS_CATEGORY_TITLE_STR[$langId]} {else} {$MC_CS_CATEGORY_TITLE_PLR_STR[$langId]} {/if} {/if} </div> <div class="modal-crossselling__cs-container" style=" background: {$MC_CROSSSELLING_BG_COLOR}; border: 1px solid {$MC_CROSSSELLING_BD_COLOR}; border-radius: {$MC_CROSSSELLING_BD_RADIUS}px; padding: {$MC_CROSSSELLING_PADDING}px; " > {foreach $crossSellingProducts as $crossSellingProduct} <div class="modal-crossselling__cs-product crossselling-product" style="width: {($MC_POPIN_WIDTH - $MC_POPIN_PADDING * 2 - $MC_CROSSSELLING_PADDING * 2 - 2) / $MC_CROSSSELLING_NB_PRODUCT}px;" > <img class="crossselling-product__image" src="{$link->getImageLink($crossSellingProduct->link_rewrite, $crossSellingProduct->id_image, $MC_CS_IMAGE_FORMAT)}" alt="{$product->name[$langId]}" /> <div class="crossselling-product__title" style=" font-size: {$MC_CS_DTLS_TITLE_FONT_SIZE}px; color: {$MC_CS_DTLS_TITLE_FONT_COLOR}; line-height: {$MC_CS_DTLS_TITLE_FONT_SIZE}px; " > {$crossSellingProduct->name[$langId]} </div> {if $crossSellingProduct->price != $crossSellingProduct->priceWhitoutReduction} <div class="crossselling-product__discount-price" style=" font-size: {$MC_CS_DTLS_DSCT_PRICE_FONT_SIZE}px; color: {$MC_CS_DTLS_DSCT_PRICE_FONT_COLOR}; line-height: {$MC_CS_DTLS_DSCT_PRICE_FONT_SIZE}px; " > {displayPrice price=$crossSellingProduct->price} </div> <div class="crossselling-product__old-price" style=" font-size: {$MC_CS_DTLS_PRICE_FONT_SIZE}px; color: {$MC_CS_DTLS_PRICE_FONT_COLOR}; line-height: {$MC_CS_DTLS_PRICE_FONT_SIZE}px; " > {displayPrice price=$crossSellingProduct->priceWhitoutReduction} </div> {else} <div class="crossselling-product__price" style=" font-size: {$MC_CS_DTLS_PRICE_FONT_SIZE}px; color: {$MC_CS_DTLS_PRICE_FONT_COLOR}; line-height: {$MC_CS_DTLS_PRICE_FONT_SIZE}px; " > {displayPrice price=$crossSellingProduct->price} </div> {/if} {if !empty($MC_BUTTON_ADD_STR[$langId])} <form method="post" action="{$link->getPageLink('cart', true)}"> <input type="text" name="qty" value="1"/> <input type="hidden" name="id_product" value="{$crossSellingProduct->id}" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="id_product_attribute" value="0" /> <button type="submit" class="modal-crossselling__btn modal-crossselling__btn--add" href="{$link->getPageLink($order_process, true)}" style=" color: {$MC_BUTTON_ADD_FONT_COLOR}; font-size: {$MC_BUTTON_ADD_FONT_SIZE}px; background: {$MC_BUTTON_ADD_BG_COLOR_C}; background: -moz-linear-gradient( top, {$MC_BUTTON_ADD_BG_COLOR_C} 0%, {$MC_BUTTON_ADD_BG_COLOR_B}); background: -webkit-gradient( linear, left top, left bottom, from({$MC_BUTTON_ADD_BG_COLOR_C}), to({$MC_BUTTON_ADD_BG_COLOR_B})); background: linear-gradient( top, {$MC_BUTTON_ADD_BG_COLOR_C} 0%, {$MC_BUTTON_ADD_BG_COLOR_B}); border: 1px solid {$MC_BUTTON_ADD_BD_COLOR}; margin-top: {$MC_BUTTON_ADD_SPACING}px; border-radius: {$MC_BUTTON_ADD_RADIUS}px; " > {$MC_BUTTON_ADD_STR[$langId]} </button> </form> {/if} </div> {/foreach} </div> {/if} <div class="modal-crossselling__button-container" style="margin-top: {$MC_BUTTON_AREA_SPACING}px" > {if !empty($MC_BUTTON_CART_STR[$langId])} <a class="modal-crossselling__btn modal-crossselling__btn--order" href="{$link->getPageLink($order_process, true)}" style=" color: {$MC_BUTTON_CART_FONT_COLOR}; font-size: {$MC_BUTTON_CART_FONT_SIZE}px; background: {$MC_BUTTON_CART_BG_COLOR_C}; background: -moz-linear-gradient( top, {$MC_BUTTON_CART_BG_COLOR_C} 0%, {$MC_BUTTON_CART_BG_COLOR_B}); background: -webkit-gradient( linear, left top, left bottom, from({$MC_BUTTON_CART_BG_COLOR_C}), to({$MC_BUTTON_CART_BG_COLOR_B})); background: linear-gradient( top, {$MC_BUTTON_CART_BG_COLOR_C} 0%, {$MC_BUTTON_CART_BG_COLOR_B}); border: 1px solid {$MC_BUTTON_CART_BD_COLOR}; border: 1px solid {$MC_BUTTON_CART_BD_COLOR}; border-radius: {$MC_BUTTON_CART_RADIUS}px; " > {$MC_BUTTON_CART_STR[$langId]} </a> {/if} {if !empty($MC_BUTTON_SHOP_STR[$langId])} <span class="modal-crossselling__btn modal-crossselling__btn--shop js-modal-crossselling__close" style=" color: {$MC_BUTTON_SHOP_FONT_COLOR}; font-size: {$MC_BUTTON_SHOP_FONT_SIZE}px; background: {$MC_BUTTON_SHOP_BG_COLOR_C}; background: -moz-linear-gradient( top, {$MC_BUTTON_SHOP_BG_COLOR_C} 0%, {$MC_BUTTON_SHOP_BG_COLOR_B}); background: -webkit-gradient( linear, left top, left bottom, from({$MC_BUTTON_SHOP_BG_COLOR_C}), to({$MC_BUTTON_SHOP_BG_COLOR_B})); background: linear-gradient( top, {$MC_BUTTON_SHOP_BG_COLOR_C} 0%, {$MC_BUTTON_SHOP_BG_COLOR_B}); border: 1px solid {$MC_BUTTON_SHOP_BD_COLOR}; border: 1px solid {$MC_BUTTON_SHOP_BD_COLOR}; border-radius: {$MC_BUTTON_SHOP_RADIUS}px; " > {$MC_BUTTON_SHOP_STR[$langId]} </span> {/if} </div> </div></div> _____________________________________________ Thank you for your help. Link to comment Share on other sites More sharing options...
sm5k Posted December 16, 2013 Author Share Posted December 16, 2013 Any Ideas? Thank YOU!! Link to comment Share on other sites More sharing options...
NemoPS Posted December 16, 2013 Share Posted December 16, 2013 To get the product link, you can use {$link->getProductLink($product.id_product, $product.link_rewrite)} If it's an object, user $product->id and $product->link_rewrite instead 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now