mastek Posted January 27, 2015 Share Posted January 27, 2015 Witam, Czy istnieje możność ustawienia sklepu tak żeby klawisz "Dodaj do koszyka" działał na zasadzie takiego warunku: 1. Jeżeli produkt posiada warianty to otwórz okno szybkiego podkładu.2. Natomiast jeżeli produkt nie posiada wariantów to otwiera okno dodaj do koszyka. Jeżeli sklep na to nie pozwala to czy ktoś jest w stanie pomóc mi napisać taki warunek. Domyślam się że wszystko jest w pliku product-list.tpl Prestashop: 1.6.0.9, skórka: default-bootstrap. Teraz sklep działa tak że jak kliknę szybki podgląd to widzę w popupie warianty, a jak kliknę "Do koszyka" to dodaje mi chyba pierwszy lepszy wariant. Link to comment Share on other sites More sharing options...
hatak Posted January 27, 2015 Share Posted January 27, 2015 http://www.presto-changeo.com/en/attribute-modules/59-product-list-attributes.html Link to comment Share on other sites More sharing options...
mastek Posted January 28, 2015 Author Share Posted January 28, 2015 Zupełnie nie o to mi chodzi, produkty z kilkoma opcjami, wieloma kolorami będą wyglądały bardzo słabo. Mnie tylko interesuje oprogramowanie guzika "Dodaj do koszyka" a by po kliknięciu odpalały się dwa już gotowe/zrobione widoki w zależności od takiego wariantu. if produkt ma warianty then link=quick-view (załacznik1.jpg) else link=button ajax_add_to_cart_button btn btn-default (załącznik2.jpg) tylko pytanie jak to poprawnie napisać Link to comment Share on other sites More sharing options...
mastek Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) Nie rozumiem tego kodu, albo on nie działa Za co odpowiada to: id_product_attribute == 0 albo $product.customization_required lub $static_token {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)} {if isset($static_token)} <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span></a> {else} <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> {/if} {else} <span class="button ajax_add_to_cart_button btn btn-default disabled"> <span>{l s='Add to cart'}</span> </span> {/if} {/if} Edited January 28, 2015 by mastek (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted January 28, 2015 Share Posted January 28, 2015 (edited) Możesz to zrobić na takiej zasadzie {if $product.id_product_attribute == 0} <div class="quick-view2"> <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> </div> {else} {if isset($quick_view) && $quick_view} <div class="quick-view-wrapper-mobile"> <a class="quick-view-mobile" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"> <i class="icon-eye-open"></i> </a> </div> <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"> <span>{l s='Quick view'}</span> </a> {/if} {/if} Z tym że klasę quick-view2 bedziesz musiał podrobić pod siebie, na podobnej zasadzie jak klasa quick-view. Edited January 28, 2015 by endriu107 (see edit history) 1 Link to comment Share on other sites More sharing options...
mastek Posted January 28, 2015 Author Share Posted January 28, 2015 Dziękuje bardzo, działa - pilnuje stanów (nie da się zamówić jak jest stan 0) więc jest git:) (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > To w sumie za co te wszystkie warunki odpowiadają, jak je teraz wywaliłeś ? Link to comment Share on other sites More sharing options...
endriu107 Posted January 28, 2015 Share Posted January 28, 2015 Generalnie to można by było usprawnić ten mój kod ale najważniejsze że działa, jak by jakieś błędy były to w wolnej chwili.... Link to comment Share on other sites More sharing options...
mastek Posted January 28, 2015 Author Share Posted January 28, 2015 Jest super, poprawiłem sobie to na taki kod (trochę miej, było tam jakieś "zero") i zostaje tylko ostylowanie <span class="button"> i jest gitara.Jeszcze raz wielkie dzięki. {if $product.id_product_attribute == 0} <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> {else} {if isset($quick_view) && $quick_view} {if $product.id_product_attribute == 0}{/if} <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"> <span class="button">{l s='Add to cart'}</span> </a> {/if} {/if} Link to comment Share on other sites More sharing options...
endriu107 Posted January 28, 2015 Share Posted January 28, 2015 (edited) A faktycznie jest tam zero ale to stąd ze w pierwszej kolejności pisałem kod na elemencie tekstowym dopiero później na docelowych przyciskach więc generalnie linia 68 do edycji za chwile poprawie co by inni nie przepisywali głupot. Edycja. A to Twój kod poprawiony: {if $product.id_product_attribute == 0} <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}"> <span>{l s='Add to cart'}</span> </a> {else} {if isset($quick_view) && $quick_view} <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"> <span class="button">{l s='Add to cart'}</span> </a> {/if} {/if} Edited January 28, 2015 by endriu107 (see edit history) 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