Ясно. А может можно попробовать, что получилось? Мне изменять кол-во и прочее вовсе не надо. Просто чтобы был комплект в карточке
на данный момент наработок нет (лично у меня), возможно где-то что-то и осталось, но в данный момент ничего готового или полуготового, тем более гайда нет.
$selurl = JFactory::getURI()->toString();
$ItemsInCart = JBCart::getInstance()->getItems();
$BasketUrlEl = $this->app->jbrouter->basket();
$currentItemUrl = $this->app->jbrouter->externalItem($this->_item);
$jbAdvertTextPaidBtn = $jbcustomPayBtnTxt;
$styledn = " style='display:none !important;' ";
$md5key = md5($rand);
$custom_id = $this->_item->id;
$jbAdvertOplata = JFactory::getApplication()->input->get('oplata', null, 'string');
$jbAdvertSkidka = JFactory::getApplication()->input->get('onlyforyou', null, 'string');
$jbvariantCena = JFactory::getApplication()->input->get('jbvariant', null, 'string');
$jbvariantkey = JFactory::getApplication()->input->get('jbvariantkey', null, 'string');
$jbvariantdiscount = JFactory::getApplication()->input->get('jbvariantdiscount', null, 'string');
$jbvariantmyprice = JFactory::getApplication()->input->get('jbvariantmyprice', null, 'string');
$Cena = JFactory::getApplication()->input->get('Cena_Price', null, 'int');
$nocacheget = JFactory::getApplication()->input->get('nc', null, 'int');
$NameCena = JFactory::getApplication()->input->get('Selectname_Cena', null, 'string');
$alltotal = $Cena * $quantity;
$uri = JFactory::getURI();
$url = $uri->toString(array('path', 'query', 'fragment'));
// var_jbdump($url);
$session = JFactory::getSession();
$config = JBCart::getInstance()->getConfig();
// jbdump($config,0,'config');
// jbdump($this->_item->getElement($CB_price)->data(),0,'asp');
$getSelect = $jbcustomPayPriceSelectID;
$SelectEl = $this->_item->getElement($CB_price)->getElement($getSelect);
$SelectElItem_id = $SelectEl->item_id;
$SelectElid = $SelectEl->element_id;
$GetSelectConfig = $SelectEl->config;
$GetSelectName = $GetSelectConfig->name;
$GetSelectOptions = $GetSelectConfig->options;
$GetSelectType = $GetSelectConfig->type;
if (!empty($CB_SKU_App->find('1._value.value'))) {
$countCena = count($CB_SKU_App);
$CenaSelect = $getSelect;
// /\_____/\
// / o o \
// ( == ^ == )
// ) (
// ( )
// ( ( ) ( ) )
// (__(__)___(__)__)
$allifprice = $countCena;
for ($i=0; $i < $allifprice; $i++) {
if (!empty($jbcustomPayOffset) && $jbcustomPayOffsetrule == 1 && $i < $jbcustomPayOffset) {
$i = $jbcustomPayOffset;
}
if (!empty($jbcustomPayOffsetEnd) && $i == $jbcustomPayOffsetEnd) {
$allifprice = $jbcustomPayOffsetEnd;
}
// $tests = 'Начало '.$i;
// jbdump($tests,0,'#');
@$vatiationsstor = $CB_SKU_App[$i];
@$VariantCenaVal = $vatiationsstor['_value']['value'];
if (!empty($VariantCenaVal)) {
if (!empty($vatiationsstor[''.$getSelect.'']['value'])) {
$NameVariantCenaVal = $vatiationsstor[''.$getSelect.'']['value']; }
// jbdump($VariantCenaVal,0,'VariantCenaVal');
// jbdump($NameVariantCenaVal,0,'NameVariantCenaVal');
$Selectname_Cena = trim(strip_tags($CB_SKU_App->find(''.$i.'.'.$CenaSelect.'.value')));
$Cena_Price = trim(strip_tags($CB_SKU_App->find(''.$i.'._value.value')));
@$valuesar = array ($GetSelectName => $NameVariantCenaVal);
$result = array(
'_default' => (int) $i, // порядок 1
'_priceId' => $CB_price,
'_itemId' => $this->_item->id,
);
$values = $valuesar;
if (!empty($values)) {
$result['values'] = $values;
}
ksort($result);
// jbjbdump::log($result);
// jbdump($result,0,'result');
$key = md5(serialize($result));
// jbjbdump::log($key);
$mincount = $jbcustomPaymin;
$maxcount = $jbcustomPaymax;
// jbdump($key,0,'key');
echo "<script>jQuery(document).ready(function(){jQuery('.quantity-right-plus".$i."').click(function(a){a.preventDefault();a=parseInt(jQuery('#quantity".$i."').val());jQuery('#quantity".$i."').val(a+1)});jQuery('.quantity-left-minus".$i."').click(function(a){a.preventDefault();a=parseInt(jQuery('#quantity".$i."').val());0<a&&jQuery('#quantity".$i."').val(a-1)})});</script>";
$renderPlusAndMinus = '
<div class="col-lg-10 col-md-10 addpadmy">
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="quantity-left-minus'.$i.' btn btn-danger btn-number btn-xs" data-type="minus" data-field="">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
<input type="text" id="quantity'.$i.'" name="quantity" class="form-control input-number" value="1" min="1" max="100">
<span class="input-group-btn">
<button type="button" class="quantity-right-plus'.$i.' btn btn-success btn-number btn-xs" data-type="plus" data-field="">
<span class="glyphicon glyphicon-plus"></span>
</button>
</span>
</div>
</div>';
// for $i = 0
if ($i != 0) {
if (!empty($jbAdvertSkidka)) {
foreach ($InItem_array as $skidos) {
preg_match("/\*.+/", $skidos, $nameskidos);
@$nameskidos = str_replace('*','',$nameskidos[0]);
@$nameskidos = (string) $nameskidos;
// jbdump($nameskidos,0,'nameskidos');
preg_match("/.+\*/", $skidos, $valueskidos);
@$valueskidos = str_replace('*','',$valueskidos[0]);
@$valueskidos = (int) $valueskidos;
if ($jbAdvertSkidka == $nameskidos) {
$jbvariantdiscount = $valueskidos;
}
// jbdump($valueskidos,0,'valueskidos');
}
}
else {
$jbvariantdiscount = 0;
}
$SkidkaMinusCena = '';
if (!empty($jbAdvertSkidka)) {
if (!empty($jbcustomCuponPercent) && $jbvariantdiscount > $Cena_Price && null !== $InItemVal) {
$CleanPercentC = str_replace('%','', $jbcustomCuponPercent);
$CleanPercentC = $Cena_Price * ($CleanPercentC / 100);
@$jbvariantskidkateaser = $CleanPercentC;
@$SkidkaMinusCena = $Cena_Price - $jbvariantskidkateaser;
// jbdump($jbvariantskidka,0,'jbvariantskidka');
}
if (!empty($jbcustomCuponPercent) && $jbvariantdiscount < $Cena_Price && null !== $InItemVal) {
@$jbvariantskidkateaser = $jbvariantdiscount;
@$SkidkaMinusCena = $Cena_Price - $jbvariantskidkateaser;
// jbdump($jbvariantskidka,0,'jbvariantskidkwa');
}
}
echo "<tr><td>";
echo "<div class='paytopostcb9t'>";
echo "<form method='post' class='postcb9t' action='{$currentItemUrl}?oplata={$ElmIdmd5}&onlyforyou=$jbvariantdiscount&nc={$rand}' enctype='multipart/form-data'>";
echo "<div class='selectcena poscena{$i}'>";
if (!empty($Selectname_Cena)) {
echo "<input type='text' {$styledn} value='{$Selectname_Cena}' name='Selectname_Cena' /> {$Selectname_Cena}";
}
else {
$CustomSelectname_Cena = 'Стандартная цена';
$Selectname_Cena = $CustomSelectname_Cena;
echo "<input type='text' {$styledn} value='{$Selectname_Cena}' name='Selectname_Cena' /> {$Selectname_Cena}";
}
echo "</div></td><td class='cenacenter'>";
if (!empty($jbvariantskidkateaser)) {
echo "<div class='cenaprice cenapricez{$i} skidkapricevisual'>";
}
else {
echo "<div class='cenaprice cenapricez{$i}'>";
}
echo "<input type='text' {$styledn} value='{$Cena_Price}' name='Cena_Price' /> <span> {$Cena_Price} </span> {$SkidkaMinusCena} ₽";
echo "</div>";
// $renderPlusAndMinus;
echo "
<label class='dnnn'><input type='hidden' value='{$ElmIdmd5}' name='oplata' /></label>
<label class='dnnn'><input type='hidden' value='{$rand}' name='nc' /></label>
<label class='dnnn'><input type='hidden' value='{$i}' name='jbvariant' /></label>
<label class='dnnn'><input type='hidden' value='{$key}' name='jbvariantkey' /></label>
<label class='dnnn'><input style='text-align: center' type='hidden' value='0' name='jbvariantmyprice' /></label>
<button class=' btn btn-success intablebtnsub btn-xs' type='submit' /><span class='glyphicon glyphicon-shopping-cart'></span> {$jbAdvertTextPaidBtn}</button>
</form>";
echo "</div>";
echo "</td></tr>";
}
} //end $iecho "
}
if ($jbcustomPayAlertRadio == 1) {
if ($jbAdvertOplata == $ElmIdmd5 && $ItemsInCart == 1) {
$alertScript = '<script>';
$alertScript .= '
swal( {title: "'.$jbAdvertDublcustom.'",type:"error", timer: 3000, showConfirmButton: false });
';
if($jbcustomPayRedirectRadio != 0) {
$alertScript .='
setTimeout(function(){
window.location.href="'.$BasketUrlEl.'";
}, 2000);';
}
$alertScript .= '</script>';
echo $alertScript;
}
}
$cart = JBCart::getInstance();
// $key = $cart->getItem->getSessionKey();
// var_jbdump($nocacheget);
$session = JFactory::getSession();
$getnccheck = $session->get('nccheck');
// var_jbdump($getnccheck);
if ($jbAdvertOplata == $ElmIdmd5 && $getnccheck != $nocacheget) {
if ($jbcustomPayRemoveRadio == 1) {
JBCart::getInstance()->removeItems();
}
if (!empty($jbAdvertSkidka)) {
$jbvariantdiscount = $jbAdvertSkidka;
if (!empty($jbcustomCuponPercent) && $jbAdvertSkidka > $Cena) {
$CleanPercentCoupon = str_replace('%','', $jbcustomCuponPercent);
$CleanPercentCoupon = $Cena * ($CleanPercentCoupon / 100);
$jbvariantdiscount = $CleanPercentCoupon;
}
if (!empty($jbcustomCuponmin)) {
$mincount = $jbcustomCuponmin;
}
if (!empty($jbcustomCuponmax)) {
$maxcount = $jbcustomCuponmax;
}
}
$jbData = array(
'key' => $jbvariantkey,
'item_id' => $this->_item->id,
'item_name' => $this->_item->name,
'element_id' => $CB_price,
'total' => $Cena - $jbvariantdiscount.' rub',
'quantity' => $quantity,
'template' => array (
$jbcustomPayPriceTemplateID => $jbcustomPayPriceTemplateName,
// 'a5d64b1d3306eea38b773e20b23e3ec8' => 'default',
),
'values' => array (
'Парам.: select' => $NameCena,
),
'selected' => array (
$getSelect => array (
'value' => $NameCena,
),
),
'elements' => array (
'_sku' => $this->_item->name,
'_value' => (string)$Cena,
'_discount' => null,
'_quantity' => null,
'_buttons' => null,
'_margin' => null,
),
'params' => array (
'sku' => [],
'value' => [],
'quantity' => array (
'min' => (float)number_format(1,1),
'max' => (float)number_format(999,1),
'step' => (float)number_format(1,1),
'default' => (float)number_format(1,1),
'decimals' => (float)number_format(0,1),
),
// 'buttons' => array (
// 'hash' => null,
// 'item_id' => $this->_item->id,
// 'element_id' => $CB_price,
// 'key' => '7cf4d4af4e500746a4d221449ff373a3',
// 'basket' => 'http://cart.local/index.php?option=com_zoo&controller=basket&task=index&Itemid=101&nc=2334',
// 'isModal' => false,
// 'isInCart' => 1,
// 'addAlert' => 0,
// 'addAlertText' => 'Товар добавлен в корзину!',
// 'addAlertTimeout' => 3000,
// 'remove' => 'http://cart.local/?option=com_zoo&controller=default&task=callelement&element=1a930b64-0ac9-4767-892d-ac2844a11d7d&method=ajaxRemoveFromCart&item_id=1',
// 'add' => 'http://cart.local/?option=com_zoo&controller=default&task=callelement&element=1a930b64-0ac9-4767-892d-ac2844a11d7d&method=ajaxAddToCart&item_id=1',
// 'modal' => 'http://cart.local/?option=com_zoo&controller=default&task=callelement&element=1a930b64-0ac9-4767-892d-ac2844a11d7d&method=ajaxModalWindow&item_id=1&args%5Btemplate%5D=modal&tmpl=component&modal=1',
// ),
),
'modifiers' => [],
'variant' => (int)$jbvariantCena,
'variations' => array (
0 => array (
'_sku' => array (
'value' => $this->_item->name,
),
'_value' => array (
'value' => (string)$Cena_Price = trim(strip_tags($CB_SKU_App->find('0._value.value'))),
),
),
(int)$jbvariantCena => array (
'_value' => array (
'value' => (string)$Cena,
),
'_discount' => array (
'value' => (string)$jbvariantdiscount,
),
$getSelect => array (
'value' => $NameCena,
),
)
),
'isOverlay' => false,
'params' => array(
'_quantity' => array(
'min' => $mincount,
'max' => $maxcount,
'step' => 1,
'default' => 1,
'decimals' => 0
)
) ,
);
$jbData = $this->app->data->create($jbData);
$addcartjb = JBCart::getInstance()->addItem($jbData);
if ($jbcustomPayRedirectRadio != 0) {
JFactory::getApplication()->redirect($BasketUrlEl);
}
$nccheck = $session->set('nccheck', $nocacheget);
// if (!empty($nocacheget)) {
// JFactory::getApplication()->redirect($url);
// }
}
// $orderId = '1';
// $orderModel = JBModelOrder::model();
// $orderItem = $orderModel->getById($orderId);
// jbdump($orderItem,0,'test');
$ItemsInCart = JBCart::getInstance()->getItems();
$BasketUrlEl = $this->app->jbrouter->basket();
$currentItemUrl = $this->app->jbrouter->externalItem($this->_item);
if ($debug == 1) { jbdump($ItemsInCart,0,'ItemsInCart'); }
}
Это то, что что-то похожее было в файлах. Если знаете PHP думаю поможет.