Best Answer kaza1ex , 13 March 2016 - 05:46
У меня получилось примерно так, как и хотел. Я создал товар и вывел на его страницу лишь кнопку "купить". С этой страницы я выдрал вот этот код:
<script src="http://sitename.ru/media/zoo/applications/jbuniversal/elements/jbprice/assets/js/jbprice.js?844" type="text/javascript"></script>
<script src="http://sitename.ru/media/zoo/applications/jbuniversal/cart-elements/core/price/assets/js/price.js?813" type="text/javascript"></script>
<script src="http://sitename.ru/media/zoo/applications/jbuniversal/cart-elements/price/buttons/assets/js/buttons.js?825" type="text/javascript"></script>
<script type="text/javascript">
JBZoo.DEBUG = 0;
jQuery.migrateMute = false;
JBZoo.addVar("currencyList", {
"default_cur": {
"code": "default_cur",
"value": 1,
"name": "\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e",
"format": {
"symbol": "",
"round_type": "none",
"round_value": "2",
"num_decimals": "2",
"decimal_sep": ".",
"thousands_sep": " ",
"format_positive": "%v%s",
"format_negative": "-%v%s"
}
},
"%": {
"code": "%",
"value": 1,
"name": "\u041f\u0440\u043e\u0446\u0435\u043d\u0442\u044b",
"format": {
"symbol": "%",
"round_type": "none",
"round_value": "2",
"num_decimals": "2",
"decimal_sep": ".",
"thousands_sep": " ",
"format_positive": "%v%s",
"format_negative": "-%v%s"
}
},
"rub": {
"code": "rub",
"value": 79.4488,
"name": "\u0420\u0443\u0431\u043b\u044c \u0420\u0424",
"format": {
"symbol": "\u0440\u0443\u0431",
"round_type": "none",
"round_value": 2,
"num_decimals": 0,
"decimal_sep": ".",
"thousands_sep": " ",
"format_positive": "%v %s",
"format_negative": "-%v %s"
}
},
"eur": {
"code": "default_cur",
"value": 1,
"name": "\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e",
"format": {
"symbol": "",
"round_type": "none",
"round_value": "2",
"num_decimals": "2",
"decimal_sep": ".",
"thousands_sep": " ",
"format_positive": "%v%s",
"format_negative": "-%v%s"
}
}
});
JBZoo.addVar("cartItems", {});
JBZoo.addVar("JBZOO_DIALOGBOX_OK", "Ok");
JBZoo.addVar("JBZOO_DIALOGBOX_CANCEL", "Cancel");
jQuery(function($) {
$(".jbzoo .jsGoto").JBZooGoto({}, 0);
});
jQuery(function($) {
$(".jbzoo select").JBZooSelect({}, 0);
});
jQuery(function($) {
$("[data-toggle='tooltip']").tooltip({}, 0);
});
if (typeof RokBoxSettings == 'undefined') RokBoxSettings = {
pc: '100'
};
window.addEvent("domready", function() {
new ScrollModules('rt-content-top', {
duration: 600,
transition: Fx.Transitions.Expo.easeInOut,
autoplay: 0,
delay: 5000
});
new ScrollModules('rt-content-bottom', {
duration: 600,
transition: Fx.Transitions.Expo.easeInOut,
autoplay: 0,
delay: 5000
});
});
window.addEvent('domready', function() {
new GantrySmartLoad({
'offset': {
'x': 200,
'y': 200
},
'placeholder': '/templates/rt_reflex/images/blank.gif',
'exclusion': ['']
});
});
InputsExclusion.push('.content_vote', '\#rt-popup', '\#vmMainPage')
window.addEvent('domready', function() {
new Fusion('ul.menutop', {
pill: 0,
effect: 'slide and fade',
opacity: 1,
hideDelay: 500,
centered: 0,
tweakInitial: {
'x': -10,
'y': -10
},
tweakSubsequent: {
'x': 0,
'y': 0
},
tweakSizes: {
'width': 20,
'height': 20
},
menuFx: {
duration: 300,
transition: Fx.Transitions.Circ.easeOut
},
pillFx: {
duration: 400,
transition: Fx.Transitions.Back.easeOut
}
});
});
jQuery(function($) {
$("#jbmodule-default-129").JBZooCartModule({
"url_clean": "http:\/\/sitename.ru\/?option=com_zoo&controller=basket&task=clear",
"url_reload": "http:\/\/sitename.ru\/?option=com_zoo&controller=basket&task=reloadModule&moduleId=129",
"url_item_remove": "http:\/\/sitename.ru\/?option=com_zoo&controller=basket&task=delete",
"text_delete_confirm": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u043e\u0432\u0430\u0440 \u0438\u0437 \u043a\u043e\u0440\u0437\u0438\u043d\u044b?",
"text_empty_confirm": "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0440\u0437\u0438\u043d\u0443?"
}, 0);
});
</script>
и код кнопки (выделяю отдельно, т.к. под кодом выше можно располагать сколь угодно таких кнопок для разных товаров):
<div class="element element-jbpriceplain first last">
<script type="text/javascript">JBZoo.mergeVar("1730d0e1f-48fc-482f-bcc2-9517c0e685fe.elements", {"buttons":{"hash":"2d7438e9709236fa00106d17558310ae","item_id":"1","element_id":"730d0e1f-48fc-482f-bcc2-9517c0e685fe","key":"ecee35db991d80b1eecae09c629c3234","basket":"http:\/\/sitename.ru\/index.php?option=com_zoo&controller=basket&task=index&Itemid=149&nc=8267","isModal":false,"isInCart":0,"addAlert":0,"addAlertText":"\u0422\u043e\u0432\u0430\u0440 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443!","addAlertTimeout":3000,"remove":"http:\/\/sitename.ru\/?option=com_zoo&controller=default&task=callelement&element=730d0e1f-48fc-482f-bcc2-9517c0e685fe&method=ajaxRemoveFromCart&item_id=1","add":"http:\/\/sitename.ru\/?option=com_zoo&controller=default&task=callelement&element=730d0e1f-48fc-482f-bcc2-9517c0e685fe&method=ajaxAddToCart&item_id=1","modal":"http:\/\/sitename.ru\/?option=com_zoo&controller=default&task=callelement&element=730d0e1f-48fc-482f-bcc2-9517c0e685fe&method=ajaxModalWindow&item_id=1&args%5Btemplate%5D=modal&args%5Blayout%5D=full&args%5Bhash%5D=2d7438e9709236fa00106d17558310ae&tmpl=component&modal=1"}})</script><script type="text/javascript">JBZoo.mergeVar("1730d0e1f-48fc-482f-bcc2-9517c0e685fe.template", {"2d7438e9709236fa00106d17558310ae":"default"})</script><div id="jbprice-145392" class="jsPrice-1-730d0e1f-48fc-482f-bcc2-9517c0e685fe jsPrice jsJBPrice jsJBPrice-730d0e1f-48fc-482f-bcc2-9517c0e685fe-1 2d7438e9709236fa00106d17558310ae jbprice jbprice-tmpl-default jbprice-type-plain" data-widgetid="1">
<div data-identifier="_buttons" data-template="default" data-index="0" data-position="list" class="jbprice-buttons jsElement jsPriceElement jsButtons jsCore jselementdefaultlist0" data-widgetid="2">
<!--noindex-->
<div class="jbprice-buttons jsPriceButtons not-in-cart">
<span class="jsAddToCart jsGoTo btn btn-success jbprice-buttons-oneclick">
<span type="white" class="glyphicon glyphicon-share"></span> Купить</span>
</div>
<!--/noindex-->
</div>
<script type="text/javascript">
jQuery(function($){ setTimeout(function(){$("#jbprice-145392").JBZooPrice({"hash":"2d7438e9709236fa00106d17558310ae","itemId":"1","identifier":"730d0e1f-48fc-482f-bcc2-9517c0e685fe","variantUrl":"http:\/\/sitename.ru\/?option=com_zoo&controller=default&task=callelement&element=730d0e1f-48fc-482f-bcc2-9517c0e685fe&method=ajaxChangeVariant&item_id=1"}, 1);}, 0); });
</script>
</div></div>
Код я вставил на главную страницу в штмл-модуль джумла. Работает. Проблема в том, что в основе моего успеха лежит чудо. Помогите сократить код, выкинув лишнее.
Go to the full post


This topic is locked








