【发布时间】:2014-12-22 16:13:46
【问题描述】:
我为 joomla 编写了一个组件,并将它用于美德商城组件。 添加到购物车按钮显示,它也在那里,但我不知道我必须包括什么,我按下他并且产品在购物车中。
这是另一个组件,我只想在其中包含按钮。包含作品,但后面没有功能。
$this->addtocart($product)
查看.html.php
function addtocart ($product) {
if (!VmConfig::get ('use_as_catalog', 0)) {
$stockhandle = VmConfig::get ('stockhandle', 'none');
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock - $product->product_ordered) < 1) {
$button_lbl = vmText::_ ('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
$button_name = 'notifycustomer';
?>
<div style="display:inline-block;">
<a href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $product->virtuemart_product_id); ?>" class="notify"><?php echo vmText::_ ('COM_VIRTUEMART_CART_NOTIFY') ?></a>
</div>
<?php
} else {
$pr_name = $this->getPrDetails($product->virtuemart_product_id, 'product_name');
$pr_cat = $this->getCat($product->virtuemart_product_id);
?>
<div class="addtocart-area">
<form method="post" class="product" action="index.php">
<div class="addtocart-bar">
<?php
// Add the button
$button_lbl = vmText::_ ('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = ''; //$button_cls = 'addtocart_button';
?>
<?php // Display the add to cart button ?>
<span class="addtocart-button">
<?php echo shopFunctionsF::getAddToCartButton(true); ?>
</span>
<div class="clear"></div>
</div>
<input type="hidden" class="pname" value="<?php echo $pr_name ?>"/>
<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="view" value="cart"/>
<noscript><input type="hidden" name="task" value="add"/></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>"/>
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $pr_cat ?>"/>
</form>
<div class="clear"></div>
</div>
<?php
}
}
}
$product 是表的数组。按钮出现,但我需要后面的功能。我必须为此包括什么?还是不行?
需要帮助,谢谢。
【问题讨论】:
标签: php joomla include cart virtuemart