Подскажитe, использую плагин для добавления в корзину One stepcheckout. Хотелось добавить кнопки + - для колиечства товара но ничего не выходит, стандартные способы не работают(
<?php
/** ------------------------------------------------------------------------
One Page Checkout
author CMSMart Team
copyright: Copyright (c) 2012 http://cmsmart.net. All Rights Reserved.
@license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
Websites: http://cmsmart.net
Email: team@cmsmart.net
Technical Support: Forum - http://cmsmart.net/forum
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
$orderInfo = file_get_contents(JPATH_ADMINISTRATOR.'/components/com_vmmanager/helpers/config/orderInfo.json');
$orderInfo = json_decode($orderInfo);
$fontFamily = array(0=>'',1=>"'Lato',sans-serif",2=>"'Open Sans', sans-serif",3=>"'Oswald', sans-serif",
4=>"'PT Sans', sans-serif",5=>"'Raleway', sans-serif",6=>"'Roboto', sans-serif");
$orderInfo->color->titleTxtFont = $fontFamily[$orderInfo->color->titleTxtFont];
$orderInfo->color->contentTxtFont = $fontFamily[$orderInfo->color->contentTxtFont];
?>
<style>
.opc-module-content h2.opc-title.priceTitle{
background-color:<?php echo '#'.$orderInfo->color->titleBg ?>;
color: <?php echo '#'.$orderInfo->color->titleTxtCl ?>;
font-size: <?php echo $orderInfo->color->titleTxtSize.'px' ?>;
font-family: <?php echo $orderInfo->color->titleTxtFont ?>;
}
.opc-module-content form.opc-form#priceForm{
background-color:<?php echo '#'.$orderInfo->color->contentBg ?>;
}
.opc-module-content form.opc-form#priceForm .opc-table,.opc-module-content form.opc-form#priceForm .opc-table li{
color: <?php echo '#'.$orderInfo->color->contentTxtCl ?>;
font-size: <?php echo $orderInfo->color->contentTxtSize.'px' ?>;
font-family: <?php echo $orderInfo->color->contentTxtFont ?>;
}
.order-result li.total{color:<?php echo '#'.$orderInfo->color->titleBg ?>}
</style>
<h2 class="opc-title priceTitle">
<i class="<?php echo $orderInfo->color->titleIcon ?>"></i>
<span><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_ORDER_INFO'); ?></span>
</h2>
<form method="Post" action="" name="priceForm" id="priceForm" class="opc-form">
<div class="opc-table" >
<div class="order-title">
<ul>
<li class="opc-order-total"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_TOTAL') ?></li>
<li class="opc-order-discount"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_DISCOUNT') ?></li>
<li class="opc-order-tax"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_TAX') ?></li>
<li class="opc-order-qty"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_QUANTITY') ?></li>
<li class="opc-order-price"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_PRICE') ?></li>
<li class="opc-order-name"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_NAME') ?></li>
</ul>
</div>
<?php foreach ($this->cart->products as $pkey => $pvalue): ?>
<div class="order-product">
<ul>
<li class="opc-order-total">
<?php
if (VmConfig::get ('checkout_show_origprice', 1) && !empty($pvalue->prices['basePriceWithTax']) && $pvalue->prices['basePriceWithTax'] != $pvalue->prices['salesPrice']) {
echo '<span class="line-through opc-basePriceWithTax">' . $this->currencyDisplay->createPriceDiv ('basePriceWithTax', '', $pvalue->prices['basePriceWithTax'], TRUE, FALSE, $pvalue->quantity) . '</span>';
}
elseif (VmConfig::get ('checkout_show_origprice', 1) && empty($pvalue->prices['basePriceWithTax']) && $pvalue->prices['basePriceVariant'] != $pvalue->prices['salesPrice']) {
echo '<span class="line-through opc-basePriceVariant">' . $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $pvalue->prices['basePriceVariant'], TRUE, FALSE, $pvalue->quantity) . '</span>';
}
echo '<span class="opc-salesPrice">'.$this->currencyDisplay->createPriceDiv ('salesPrice', '', $pvalue->prices['salesPrice'], True, FALSE, $pvalue->quantity).'</span>';
?>
</li>
<li class="opc-order-discount">
<?php echo "<span class='opc-discountAmount'>" . $this->currencyDisplay->createPriceDiv ('discountAmount', '', $pvalue->prices['discountAmount'], True, FALSE, $pvalue->quantity) . "</span>" ?>
</li>
<li class="opc-order-tax">
<?php echo "<span class='opc-taxAmount'>" . $this->currencyDisplay->createPriceDiv ('taxAmount', '', $pvalue->prices['taxAmount'], True, FALSE, $pvalue->quantity) . "</span>" ?>
</li>
<li class="opc-order-qty">
<?php /** Show quantity */ ?>
<input type="text" value="<?php echo $pvalue->quantity ?>" name="quantity[<?php echo $pkey; ?>]" id="quantity_<?php echo $pkey; ?>" class="quantity_product" />
<span class="delete-product-cart" data-pid="<?php echo $pkey; ?>"><i class="opc-iconcancel-circled-outline"></i></span>
<span class="update-quantity"><i class="opc-iconcw"></i></span>
<input type="text" onblur="Virtuemart.checkQuantity(this,1,'Вы можете приобрести этот товар только в партии, состоящей из %s единиц(ы) товара!');" onclick="Virtuemart.checkQuantity(this,1,'Вы можете приобрести этот товар только в партии, состоящей из %s единиц(ы) товара!');" onchange="Virtuemart.checkQuantity(this,1,'Вы можете приобрести этот товар только в партии, состоящей из %s единиц(ы) товара!');" onsubmit="Virtuemart.checkQuantity(this,1,'Вы можете приобрести этот товар только в партии, состоящей из %s единиц(ы) товара!');" title="Обновить количество в корзине" class="quantity-input js-recalculate" size="3" maxlength="4" name="quantity[<?php echo $pkey; ?>]" value="<?php echo $pvalue->quantity ?>"/>
<span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus" value="+"/>
<input type="button" class="quantity-controls quantity-minus" value="-"/>
</span>
</li>
<li class="opc-order-price">
<?php
/** Show price*/
if (VmConfig::get ('checkout_show_origprice', 1) && $pvalue->prices['discountedPriceWithoutTax'] != $pvalue->prices['priceWithoutTax']) {
echo '<span class="line-through">' . $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $pvalue->prices, TRUE, FALSE) . '</span><br />';
}
if ($pvalue->prices['discountedPriceWithoutTax']) {
echo $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax', '', $pvalue->prices, true, FALSE);
} else {
echo $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $pvalue->prices, True, FALSE);
}
?>
</li>
<li class="opc-order-name">
<?php if ($pvalue->virtuemart_media_id) { ?>
<span class="cart-images">
<?php
if (!empty($pvalue->images[0])) {
echo $pvalue->images[0]->displayMediaThumb ('', FALSE);
}
?>
</span>
<?php } ?>
<div class="name-val">
<?php
echo JHtml::link ($pvalue->url, $pvalue->product_name);
echo $this->customfieldsModel->CustomsFieldCartDisplay($pvalue);
echo $pvalue->mf_name;
?>
</div>
</li>
</ul>
</div>
<?php endforeach; ?>
<div class="order-result">
<ul>
<li class="result-total"><?php echo "<span class='opc-salesPrice-total'>" . $this->currencyDisplay->createPriceDiv ('salesPrice', '', $this->cart->cartPrices['salesPrice'],True, FALSE) . "</span>"?></li>
<li class="result-discount"><?php echo "<span class='opc-discountAmount-total'>" . $this->currencyDisplay->createPriceDiv ('discountAmount', '', $this->cart->cartPrices['discountAmount'],True, FALSE) . "</span>" ?></li>
<li class="result-tax"><?php echo "<span class='opc-taxAmount-total'>" . $this->currencyDisplay->createPriceDiv ('taxAmount', '', $this->cart->cartPrices['taxAmount'], True,False) . "</span>" ?></li>
<li class="result-title"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_PRODUCT_PRICES_RESULT') ?></li>
</ul>
</div>
<div class="order-result">
<ul>
<li class="result-total"><span class="opc-salesPriceShipment"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment', '', $this->cart->cartPrices['salesPriceShipment'],true, FALSE); ?> </span></li>
<li class="result-discount"></li>
<li class="result-tax"><?php echo "<span class='opc-shipmentTax'>" . $this->currencyDisplay->createPriceDiv ('shipmentTax', '', $this->cart->cartPrices['shipmentTax'],True, FALSE) . "</span>"; ?></li>
<li class="result-title"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_SHIPPING_COST') ?></li>
</ul>
</div>
<div class="order-result">
<ul>
<li class="result-total"><span class="opc-salesPricePayment"><?php echo $this->currencyDisplay->createPriceDiv ('salesPricePayment', '', $this->cart->cartPrices['salesPricePayment'],true, FALSE); ?></span>
</li>
<li class="result-discount"></li>
<li class="result-tax"><?php echo "<span class='opc-paymentTax'>" . $this->currencyDisplay->createPriceDiv ('paymentTax', '', $this->cart->cartPrices['paymentTax'],True, FALSE) . "</span>" ?></li>
<li class="result-title"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_PAYMENT_COST') ?></li>
</ul>
</div>
<?php if($this->cart->cartPrices['salesPriceCoupon']): ?>
<div class="order-result">
<ul>
<li class="result-total"><?php echo "<span class='opc-salesPriceCoupon'>" . $this->currencyDisplay->createPriceDiv ('salesPriceCoupon', '', $this->cart->cartPrices['salesPriceCoupon'], True,FALSE) . "</span>" ?></li>
<li class="result-discount"><?php echo "<span class='opc-billDiscountAmount'>" . $this->currencyDisplay->createPriceDiv ('billDiscountAmount', '', $this->cart->cartPrices['billDiscountAmount'], True,FALSE) . "</span>" ?> </li>
<li class="result-tax"><?php echo "<span class='opc-couponTax'>" . $this->currencyDisplay->createPriceDiv ('couponTax', '', $this->cart->cartPrices['couponTax'], True,FALSE) . "</span>" ?></li>
<li class="result-title"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_COUPON_PRICE') ?></li>
</ul>
</div>
<?php endif; ?>
<div class="order-result">
<ul>
<li class="result-total total"><span class="opc-billTotal"><?php echo $this->currencyDisplay->createPriceDiv ('billTotal', '', $this->cart->cartPrices['billTotal'],True, FALSE); ?></span></li>
<li class="result-discount total"><?php echo "<span class='opc-billDiscountAmount'>" . $this->currencyDisplay->createPriceDiv ('billDiscountAmount', '', $this->cart->cartPrices['billDiscountAmount'], True,FALSE) . "</span>" ?> </li>
<li class="result-tax total"><?php echo "<span class='opc-billTaxAmount'>" . $this->currencyDisplay->createPriceDiv ('billTaxAmount', '', $this->cart->cartPrices['billTaxAmount'], True,FALSE) . "</span>" ?></li>
<li class="result-title total"><?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_TOTAL_PRICE') ?></li>
</ul>
</div>
<!-- <div class="order-coupon-code">
<input name="coupon_code" placeholder="<?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_COUPON_TEXT') ?>" maxlength="50" class="couponOpc" alt="<?php echo JText::_('SYSTEM_ONESTEPCHECKOUT_COUPON_TEXT') ?>" />
<span id="addCouponCode">Save</span>
<span><?php if($this->cart->couponCode) echo $this->cart->couponCode ?></span>
</div>-->
</div>
<script>
$(function(){
$('.quantity-plus,.quantity-minus').on('click',function() {
var
signs={'quantity-plus':1,'quantity-minus':-1},
el=$(this).parent().prev('.quantity-input'),
step=parseInt(el.attr('onblur').replace(/[^\d]/g,'')) || 1,
cls=$(this).attr('class'),
cl=cls.substring(cls.indexOf(' ')).trim(),
val=parseInt(el.val())+signs[cl]*step
;
val=val<step?step:val;
el.val(val);
$(this).parent().nextAll('span').filter('.vm2-add_quantity_cart').first().click();
});
});
</script>
</form>