不确定,我理解你的问题,但如果你需要添加add to cart
按钮,你需要传输完整的sAddToBasket
表格。
<form name="sAddToBasket" method="post" action="{url controller=checkout action=addArticle}" class="buybox--form" data-add-article="true" data-showOverlay="false" data-eventName="submit"{if $theme.offcanvasCart} data-showModal="false" data-addArticleUrl="{url controller=checkout action=ajaxAddArticleCart}"{/if}>
{if $sArticle.sConfigurator&&$sArticle.sConfiguratorSettings.type==3}
{foreach $sArticle.sConfigurator as $group}
<input type="hidden" name="group[{$group.groupID}]" value="{$group.selected_value}"/>
{/foreach}
{/if}
<input type="hidden" name="sActionIdentifier" value="{$sUniqueRand}"/>
<input type="hidden" name="sAddAccessories" id="sAddAccessories" value=""/>
<input type="hidden" name="sAdd" value="{$sArticle.ordernumber}"/>
{$sCountConfigurator=$sArticle.sConfigurator|@count}
{if (!isset($sArticle.active) || $sArticle.active)}
{if $sArticle.isAvailable}
<div class="buybox--button-container block-group{if $NotifyHideBasket && $sArticle.notification && $sArticle.instock <= 0} is--hidden{/if}">
<div class="buybox--quantity block">
{$maxQuantity=$sArticle.maxpurchase+1}
{if $sArticle.laststock && $sArticle.instock < $sArticle.maxpurchase}
{$maxQuantity=$sArticle.instock+1}
{/if}
<select name="sQuantity" class="quantity--select">
{section name="i" start=$sArticle.minpurchase loop=$maxQuantity step=$sArticle.purchasesteps}
<option value="{$smarty.section.i.index}">{$smarty.section.i.index}{if $sArticle.packunit} {$sArticle.packunit}{/if}</option>
{/section}
</select>
</div>
{* "Buy now" button *}
{if $sArticle.sConfigurator && !$activeConfiguratorSelection}
<button class="buybox--button block btn is--disabled is--icon-right is--large" disabled="disabled" aria-disabled="true" name="{s name="DetailBuyActionAdd"}{/s}"{if $buy_box_display} style="{$buy_box_display}"{/if}>
{s name="DetailBuyActionAdd"}In den Warenkorb{/s} <i class="icon--arrow-right"></i>
</button>
{else}
<button class="buybox--button block btn is--primary is--icon-right is--center is--large" name="{s name="DetailBuyActionAdd"}{/s}"{if $buy_box_display} style="{$buy_box_display}"{/if}>
{s name="DetailBuyActionAdd"}In den Warenkorb{/s} <i class="icon--arrow-right"></i>
</button>
{/if}
</div>
{/if}
{/if}
</form>
你可以在那里看到它在真实站点上是如何工作的。
取决于您可以使用sAddAccessories
和sAddAccessoriesQuantity
输入将产品列表添加到购物篮的需求,您可以在此处看到示例。如果您可以展示您的网站,我可以为您提供更适合您的情况的解决方案。当您应用自定义添加到购物车按钮时,不要忘记配置器和变体。
我希望你认为这个答案有帮助。