Hi all
I was trying to count how many product items are in a section or sub-section, using the following code added to the Section - Main Product Area Layout (INNERLAYOUT)
I added this very simple code just above "ProductLayout" in layout code.
<actinic:block php="true">$productcount = 0;</actinic:block>
<actinic:block type="ProductList" />
<actinic:block php="true">$productcount++;</actinic:block>
</actinic:block>
<actinic:block php="true">
echo "There are $productcount products in this section.";
</actinic:block>
The code works fine for sub-sections with zero or two or more products.
But if a sub-section only has one product it echo's "There are 2 products in this section."
So I changed Product list code to see what was going on.
<actinic:block type="ProductList" />
<actinic:block php="true">
$productcount++;
echo "$productcount found.";
</actinic:block>
</actinic:block>
With zero products in a sub-section nothing is echoed (correct)
On one Product "2 found." (wrong should be "1 found.")
on two Products "1 found. 2 found." (correct)
on three Products "1 found. 2 found. 3 found" (correct)
and so on.
Is this a programmng error, installation error or Actinic bug.
Thanks
Sean
I was trying to count how many product items are in a section or sub-section, using the following code added to the Section - Main Product Area Layout (INNERLAYOUT)
I added this very simple code just above "ProductLayout" in layout code.
<actinic:block php="true">$productcount = 0;</actinic:block>
<actinic:block type="ProductList" />
<actinic:block php="true">$productcount++;</actinic:block>
</actinic:block>
<actinic:block php="true">
echo "There are $productcount products in this section.";
</actinic:block>
The code works fine for sub-sections with zero or two or more products.
But if a sub-section only has one product it echo's "There are 2 products in this section."
So I changed Product list code to see what was going on.
<actinic:block type="ProductList" />
<actinic:block php="true">
$productcount++;
echo "$productcount found.";
</actinic:block>
</actinic:block>
With zero products in a sub-section nothing is echoed (correct)
On one Product "2 found." (wrong should be "1 found.")
on two Products "1 found. 2 found." (correct)
on three Products "1 found. 2 found. 3 found" (correct)
and so on.
Is this a programmng error, installation error or Actinic bug.
Thanks
Sean
Comment