- Автор темы
- #1
Здравствуйте! Есть модуль корзина для virtuemart которая после добавления не добавляет товар(необходимо обновлять страницу). Подскажите пожалуйста в чём может быть дело!?
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/*------------------------------------------------------------------------
# VMJ Modern Cart Module for Joomla 1.5 - Version 1.4 - Licence Owner
# ------------------------------------------------------------------------
# Copyright (C) 2009-2013 VMJunction Co. All Rights Reserved.
# @license - Для просмотра ссылки Войдиили Зарегистрируйся GNU/GPL
# Author: VMJunction.com
# Websites: Для просмотра ссылки Войдиили Зарегистрируйся
# This file may not be redistributed in whole or significant part.
# Icons By: Dryicons.com
-------------------------------------------------------------------------*/
$buttonimage= $params->get( 'buttonimage' );
$carticon= $params->get( 'carticon' );
$cartimage= $params->get( 'cartimage' );
$buttontext= $params->get( 'buttontext' );
$textsize= $params->get( 'textsize' );
$imageortext= $params->get( 'imageortext' );
$LiveSite = JURI::base();
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}
$cart = $_SESSION['cart'];
$auth = $_SESSION['auth'];
?>
<?php if ($cart["idx"] == 0) {
global $VM_LANG;
if ($carticon == "0") {
echo "<div style='text-align:center; padding-top:6px;'><a href='index.php?option=com_virtuemart&Itemid='><img src='".$LiveSite."".$cartimage. "' alt='".$VM_LANG->_('PHPSHOP_EMPTY_CART')."".$VM_LANG->_('VM_ORDER_EDIT_ADD_PRODUCT'). "' title='".$VM_LANG->_('PHPSHOP_EMPTY_CART')." ".$VM_LANG->_('VM_ORDER_EDIT_ADD_PRODUCT').".' border='0' style='padding-bottom:10px;'/></a> </div>
<div style='text-align:center'>".$VM_LANG->_('PHPSHOP_EMPTY_CART'). "</div>";
}
else {
}
}
else {
}
?>
<?php
global $VM_LANG, $sess, $mm_action_url;
$class_sfx = $params->get( 'class_sfx' );
mm_showMyFileName( __FILE__ );
require_once(CLASSPATH. 'ps_product.php' );
$ps_product =& new ps_product;
require_once(CLASSPATH. 'ps_shipping_method.php' );
require_once(CLASSPATH. 'ps_checkout.php' );
$ps_checkout =& new ps_checkout;
global $CURRENCY_DISPLAY, $VM_LANG, $vars;
if ($cart["idx"] == 0) {
$checkout = false;
$amount = 0;
}
else {
$my_taxrate = 0;
$checkout = True;
$total = $order_taxable = $order_tax = 0;
$amount = 0;
$weight_total = 0;
for ($i=0;$i<$cart["idx"];$i++) {
$price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"],$cart[$i]["description"]);
$amount += $cart[$i]["quantity"];
if (@$auth["show_price_including_tax"] == 1) {
$my_taxrate = $ps_product->get_product_taxrate($cart[$i]["product_id"] );
$price["product_price"] *= ($my_taxrate+1);
}
$db_data_prod = new ps_DB;
// Get the product info from the database
$db_data_prod->query( "SELECT * FROM #__{vm}_product WHERE product_id='".$_SESSION['cart'][$i]["product_id"]."'" );
$product_parent_id = $db_data_prod->f("product_parent_id");
$flypage = FLYPAGE;
if ($product_parent_id != 0) {
$db_d= new ps_DB;
$db_d->query("SELECT * FROM #__{vm}_product WHERE product_id='$product_parent_id'" );
$db_d->next_record();
}
$product_thumb_image = $product_parent_id!=0 && !$db_data_prod->f("product_thumb_image") ? $db_d->f("product_thumb_image") : $db_data_prod->f("product_thumb_image"); // Change
$productsku = $product_parent_id!=0 && !$db_data_prod->f("product_sku") ? $db_d->f("product_sku") : $db_data_prod->f("product_sku"); // Change
$productname = $product_parent_id!=0 && !$db_data_prod->f("product_name") ? $db_d->f("product_name") : $db_data_prod->f("product_name"); // Change
$productprice = $price["product_price"];
$productprice = $GLOBALS['CURRENCY']->convert( $productprice, "", $GLOBALS['product_currency'] ) ;
$productprice = Round( $productprice, 2 );
$productquantity = $cart[$i]["quantity"];
if ($product_parent_id) {
$producturl = $sess->url(URL . "index.php?option=com_virtuemart&page=shop.product_details&product_id=$product_parent_id");
}
else {
$producturl = $sess->url(URL . "index.php?option=com_virtuemart&page=shop.product_details&product_id=" . $_SESSION['cart'][$i]["product_id"]);
}
echo "<div style='margin-bottom:8px;clear:both;text-align:center;margin-top:8px;'><img src='".$LiveSite."components/com_virtuemart/shop_image/product/".$product_thumb_image. "' width='96' align='middle' alt='".$productname. "' title='".$productname. "'/></div>";
echo "<div style='float:left;padding-bottom:5px;font-size:". $textsize. ";'><a href='" .$producturl."'><strong>". $productname. "</strong></a><br/>";
echo "<span style='font-size:". $textsize. ";'><span>".$VM_LANG->_('PHPSHOP_CART_QUANTITY'). ": </span>". $productquantity. "<br/></strong>";
echo "<strong>".$VM_LANG->_('PHPSHOP_CART_PRICE'). ": </strong>".$CURRENCY_DISPLAY->getFullValue($productprice). "<br/>";
echo "<span>".$VM_LANG->_('PHPSHOP_CART_SKU'). ": </span>". $productsku. "</span></div>";
echo "<div style='clear:both;'></div><hr size='1' color='#A1A1A1' width='100%'>";
$subtotal = $productprice * $productquantity;
$total += $subtotal;
$product_rows[$i]['subtotal'] = $CURRENCY_DISPLAY->getFullValue($subtotal);
$product_rows[$i]['subtotal_with_tax'] = $CURRENCY_DISPLAY->getFullValue($subtotal * ($my_taxrate+1));
$weight_subtotal = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]["quantity"];
$weight_total += $weight_subtotal;
}
if( !empty($_SESSION['coupon_discount']) ) {
$total -= $_SESSION['coupon_discount'];
}
$show_tax = true;
$ordertotal = 0;
if ($weight_total != 0 or TAX_VIRTUAL=='1') {
$order_taxable = $ps_checkout->calc_order_taxable($vars);
$tax_total = $ps_checkout->calc_order_tax($order_taxable, $vars);
} else {
$tax_total = 0;
}
if( $auth['show_price_including_tax']) {
}
$tax_total = Round( $order_taxable );
$tax_total = $ps_checkout->calc_order_tax($order_taxable, $vars);
$ordertotal = ($tax_total) + ($total);
}
?>
<?php if ($amount >= 1)
echo "
<div style='width:100%;'>
<div style='padding-top:9px;font-size:11px;'>
<div style='float:left;font-size:". $textsize. ";'><span>".$VM_LANG->_('PHPSHOP_PRODUCTS_LBL'). ": </span></div>
<div style='float:right;font-size:". $textsize. ";'>" . $amount ."</div>
<br style='clear:both;'/>
<div style='float:left;font-size:". $textsize. ";'><span>".$VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX'). ": </span></div>
<div style='float:right;font-size:". $textsize. ";'>". $CURRENCY_DISPLAY->getFullValue($tax_total) ."</div>
<div style='clear:both;'></div>
<div style='float:left;font-size:". $textsize. ";'><strong><span>".$VM_LANG->_('PHPSHOP_CART_TOTAL'). ": </span></div>
<div style='float:right;font-size:". $textsize. ";'>". $CURRENCY_DISPLAY->getFullValue($total) ."</strong></div>
<div style='clear:both;'></div>
<div style='float:left;margin-right:15px;margin-top:2px;font-size:". $textsize. ";'>
<a title='".$VM_LANG->_('VM_ORDER_EDIT'). " 'href='" .$sess->url($mm_action_url."index.php?page=shop.cart")."' style='text-decoration:none;'>
<br/><strong>".$VM_LANG->_('VM_ORDER_EDIT'). "</strong>
</a>
</div>
<div style='clear:both;'></div>
<hr size='1' color='#A1A1A1'>
<div style='text-align:center;padding-top:12px;'>
<a href='" .$sess->url($mm_action_url."index.php?page=shop.cart")."'>";
if ($amount >= 1)
if ($imageortext == "0") {
echo "<img src='".$LiveSite."". $buttonimage. "' alt='".$VM_LANG->_('PHPSHOP_CHECKOUT_TITLE'). "' title='".$VM_LANG->_('PHPSHOP_CHECKOUT_TITLE'). "' border='0' style='padding-bottom:10px;'/>";
} else {
echo "<span style='font-size:". $textsize. ";'><strong>". $buttontext. "</strong></span><br/><br/>";
}
echo "</a>"; ?>
<?php if ($amount >= 1)
echo "</div>
</div>
</div>";?>