I have a product called customized gift box with different sizes like 5,9,12 etc.
When the users select items to the gift box and add to cart, I am fetching those chocolate names too with the Quantity of the chocolate.
In the code below, I have written if the product name includes customized then fetch the related chocolate using session in a for loop.
And the For loop is working properly but, sometimes it doesn't.
How can this be resolved?
<?php
if(stristr($this->getProductUrl(),"customized")){
?>
<div>
<?php
echo "<br/>";
$itid = $_item->getId();
echo $itid;
$strrep = str_replace(' ','_',$this->htmlEscape($this->getProductName()));
for($k=1;$k<=sizeof($_SESSION[$strrep."item".$itid]);$k++){
if($_SESSION[$strrep."item".$itid][$k]!=""){
echo " <font size='1px'>".$_SESSION[$strrep."qty".$itid][$k]." x ".$_SESSION[$strrep."item".$itid][$k]."</font><br/>";
}
}
?>
</div>