Hello!
I'm trying to modify VirtueMart cart module and add "delete" button to the list of items
(http://f1.s.qip.ru/zuH5XizP.png)
But nothing can do with it, besause i'm just a PHP programmer :-[
Trying as shown there http://forum.virtuemart.net/index.php?topic=99141.0
but after activating "plg_system_vm2_cart_j25" stops working "add to cart" button,
and got
"http://xxxxxxxxxx.ru/index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json&_=1356442163804 500 (Internal Server Error)"
in java console.
May be somebody already do it? May be there is any way to write it?
Please help with it.. :(
Joomla! 2.5.8,
VirtueMart 2.0.16
May be use some AJAX/Java request which remove product from cart by product SKU?
For example write product list in cart module by code:
<div class="vm_cart_products">
<div class="container">
<?php foreach ($data->products as $product)
{
if ($show_price) { ?>
<div class="del_<?php echo $product['product_sku'] ?>" style="float: right;">
<span class="del-button"><input type="submit" class="del-button" value="" /></span>
</div>
<div class="prices" style="float: right;">
<?php echo $product['prices'] ?></div>
<?php } ?>
<div class="product_row">
<span class="product_name"><?php echo $product['product_name'] ?></span> <span class="quantity"><?php echo $product['quantity'] ?></span> шт.
</div>
<div class="horizontal-separator"></div>
<?php
}
?>
</div>
</div>
???
From cart order page items removing by code
<a class="vmicon vm2-remove_from_cart"
title="<?php echo JText::_ ('COM_VIRTUEMART_CART_DELETE') ?>" align="middle"
href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=cart&task=delete&cart_virtuemart_product_id=' . $prow->cart_item_id) ?>">
</a>
but how to convert product_sku to cart_virtuemart_product_id??? :o :-\
OK, if we disable SEO in virtualmart and got link like
/magazin/view/productdetails/virtuemart_product_id/4/virtuemart_category_id/1.html
in $product[product_name], so...
<?php // Cut product id from product link "/magazin/view/cart/task/delete/cart_virtuemart_product_id/4.html"
$id_pos = stripos($product[product_name],'product_id/')+11;
$cat_pos = stripos($product[product_name],'/virtuemart_category_id');
$prod_id = substr ($product[product_name], $id_pos, $cat_pos - $id_pos);
?>
and we now may delete the product with
<a
class="vmicon vm2-remove_from_cart"
title="<?php echo JText::_ ('COM_VIRTUEMART_CART_DELETE') ?>"
align="middle"
href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=cart&task=delete&cart_virtuemart_product_id=' .$prod_id) ?>">
</a>
BUT we got redirecting to "main cart"... with working cart module... brrrrrrrrrr :-X :-\
(http://f2.s.qip.ru/zuH5XiC3.png)