Gentlemen, here it is my dirty and quick solution. I’m running slightly castrated and modified 4.6.4 CE (mostly templates).
- Disable option “[I]Load Selection Lists in Product Lists[/I]” to simplify life.
- Apply the following oxid anti-bug patch (I found it somewhere in bug tracks):
in the file [I]out/azure/tpl/page/checkout/inc/basketcontents.tpl[/I] replace (or comment) near line 72:
[{if !$basketitem->isBundle() || !$basketitem->isDiscountArticle()}]
[{if $oViewConf->showSelectListsInList()}]
[{assign var="oSelections" value=$basketproduct->getSelections(null,$basketitem->getSelList())}]
[{if $oSelections}]
<div class="selectorsBox clear" id="cartItemSelections_[{$smarty.foreach.basketContents.iteration}]">
[{foreach from=$oSelections item=oList name=selections}]
[{include file="widget/product/selectbox.tpl" oSelectionList=$oList sFieldName="aproducts[`$basketindex`][sel]" iKey=$smarty.foreach.selections.index blHideDefault=true sSelType="seldrop"}]
[{/foreach}]
</div>
[{/if}]
[{/if}]
[{/if }]
with:
[{if !$basketitem->isBundle() || !$basketitem->isDiscountArticle()}]
[{assign var="oSelections" value=$basketproduct->getSelections(null,$basketitem->getSelList())}]
[{if $oSelections}]
<div class="selectorsBox clear" id="cartItemSelections_[{$smarty.foreach.basketContents.iteration}]">
[{foreach from=$oSelections item=oList name=selections}]
[{if $oViewConf->showSelectListsInList()}]
[{include file="widget/product/selectbox.tpl" oSelectionList=$oList sFieldName="aproducts[`$basketindex`][sel]" iKey=$smarty.foreach.selections.index blHideDefault=true sSelType="seldrop"}]
[{else}]
[{assign var="oActiveSelection" value=$oList->getActiveSelection()}]
[{if $oActiveSelection}]
<input type="hidden" name="aproducts[[{$basketindex}]][sel][[{$smarty.foreach.selections.index}]]" value="[{if $oActiveSelection }][{$oActiveSelection->getValue()}][{/if}]">
<div>[{$oList->getLabel()}]: [{$oActiveSelection->getName()}]</div>
[{/if}]
[{/if}]
[{/foreach}]
</div>
[{/if}]
[{/if }]
- Create a file out/azure/src/js/widgets/price.js:
window.basePrice=null;
$("ul.drop.seldrop.FXgradGreyLight.shadow li a").click(function() {
if (document.getElementById("ThisIsaPrice") != null) {
if (basePrice==null ) basePrice = parseFloat(document.getElementById("ThisIsaPrice").innerText);
}
var currentMod = parseFloat(getAmount($(this).text()));
curItemIndex= $(this).parent().parent().parent().index();
$('#productSelections > div > p > span').each(function(i){
if (i != curItemIndex) currentMod = currentMod + parseFloat(getAmount($(this).text()));
});
document.getElementById("ThisIsaPrice").innerText = toFixed(currentMod + basePrice,2);
return false;
function toFixed(value, precision) {
var power = Math.pow(10, precision || 0);
return String(Math.round(value * power) / power);
}
function getAmount(value) {
modSum = value.match(/[-+]?\d*\.\d+/);
if (modSum==null) return ("0");
return modSum;
}
});
- In the file out/azure/tpl/page/details/inc/productmain.tpl near line 252 insert [B]id=“ThisIsaPrice”[/B]:
<strong >
<span id="ThisIsaPrice">[{$fPrice}]</span>
<span>[{ $currency->sign}]</span>
<span>*</>
</strong>
- In the file [I]out/azure/tpl/widget/product/selectbox.tpl[/I] insert line in the beginning:
[{oxscript include="js/widgets/price.js" priority=10 }]
- Enjoy or fix my bugs.