PDA

View Full Version : Trouble with Category List Displaying


imnotinsane
11-01-06, 02:11 AM
I am having a little trouble getting it to display product quantities in my category listing. I created some custom fields one of them containing the price and the other containing the product code for the item with the quantity discount. For some reason nothing is showing up. As far as i can tell there are no errors in the miva script (at least nothing popped up telling me there is an error in the syntax) so it should show up. Here's the code i am using.

<mvt:foreach iterator="product" array="products">

<div class="mC_standardBox">
<div class="mC_Box_Title"><a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:store:code;&Product_Code=&mvta:product:code;&Category_Code=&mvta:category:code;">&mvt:product:name;</a></div>

<mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
<a href="&mvt:global:sessionurl;Screen=PROD&Store_Code=&mvta:store:code;&Product_Code=&mvta:product:code;&Category_Code=&mvta:category:code;"><img src="&mvte:product:thumbnail;" border=0 class="mC_Image_Border" /></a>
<mvt:else>
&nbsp;
</mvt:if>
<div class="mC_ProductBox_Price">
<ul>
<li>Our Price: &mvt:product:formatted_price;</li>
<li>
<form method="post" action="&mvt:global:secure_sessionurl;">
<input type="hidden" name="Action" value="ADPR">
<input type="hidden" name="Product_Code" value="&mvte:product:code;">
<input type="hidden" name="Quantity" value=1>
<input type="hidden" name="Screen" value="OINF">
<input type="hidden" name="Attributes" value="Yes">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="image" src="http://www.rhdev.com/uni/img/addcart.gif" name="SRCH" alt="Start Searching" class="mC_ProductBox_img" /></form>
</li>
<li>

<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :qd1Code">
<table width="100%" border="0" cellpadding="0">
<tr>
<td colspan="2">Quantity Discount</td>
</tr>
<tr>
<td width="76%">&mvt:product:customfield_values:customfields:qd1Des c;</td>
<td width="24%" valign="bottom"> <a href="merchant.mvc?Screen=BASK&Store_Code=&mvte:global:Store_Code;&Action=ADPR&Product_Code=&mvt:product:customfield_values:customfields:qd1Cod e;&Attributes=Yes&Quantity=1"><img src="http://www.rhdev.com/uni/img/cart.gif" /></a></td>
</tr>

<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :qd2Code">
<tr>
<td width="76%">&mvt:product:customfield_values:customfields:qd2Des c;</td>
<td width="24%" valign="bottom"> <a href="merchant.mvc?Screen=BASK&Store_Code=&mvte:global:Store_Code;&Action=ADPR&Product_Code=&mvt:product:customfield_values:customfields:qd2Cod e;&Attributes=Yes&Quantity=1"><img src="http://www.rhdev.com/uni/img/cart.gif" /></a></td>
</tr>
</mvt:if>

<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :qd3Code">
<tr>
<td width="76%">&mvt:product:customfield_values:customfields:qd3Des c;</td>
<td width="24%" valign="bottom"> <a href="merchant.mvc?Screen=BASK&Store_Code=&mvte:global:Store_Code;&Action=ADPR&Product_Code=&mvt:product:customfield_values:customfields:qd3Cod e;&Attributes=Yes&Quantity=1"><img src="http://www.rhdev.com/uni/img/cart.gif" /></a></td>
</tr>
</mvt:if>

<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :qd4Code">
<tr>
<td width="76%">&mvt:product:customfield_values:customfields:qd4Des c;</td>
<td width="24%" valign="bottom"> <a href="merchant.mvc?Screen=BASK&Store_Code=&mvte:global:Store_Code;&Action=ADPR&Product_Code=&mvt:product:customfield_values:customfields:qd4Cod e;&Attributes=Yes&Quantity=1"><img src="http://www.rhdev.com/uni/img/cart.gif" /></a></td>
</tr>
</mvt:if>

<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :qd5Code">
<tr>
<td width="76%">&mvt:product:customfield_values:customfields:qd5Des c;</td>
<td width="24%" valign="bottom"> <a href="merchant.mvc?Screen=BASK&Store_Code=&mvte:global:Store_Code;&Action=ADPR&Product_Code=&mvt:product:customfield_values:customfields:qd5Cod e;&Attributes=Yes&Quantity=1"><img src="http://www.rhdev.com/uni/img/cart.gif" /></a></td>
</tr>
</mvt:if>


</table>
</mvt:if>


</li>
</ul>
</div>

<p>&mvt:product:descrip;</p>
</div>

</mvt:foreach>

The main part is the if statement that determines if there is a quantity discount on the product then displays it. Thanks for any help you can give

Vic - WolfPaw Computers
11-01-06, 02:36 AM
If you are setting a quantity box, why do all your form posts have a fixed quantity of 1, including the hidden field. Or maybe I'm not understanding what exactly you are attempting to accomplish.

You also should consider using &mvt:global:sessionurl instead of "merchant.mvc?" in all your URLs.

As well, consider putting your images inside /mm5/graphics otherwise you will likely wind up with SSL errors if you are on a shared SSL cert.

imnotinsane
11-01-06, 03:16 AM
As far as i knew, (at least what i have been told) the best way to do quantity discounts is to have a second product. for example, i am selling a cd at 4.95 - If you were to buy a 5 pack it would cost you 17.95 which translates to 3.59 each cd. This explains why i forced the quantity to one.

If you know of a better way that is a true quantity discount system where i can offer a 5+ price, 25+ price etc i would love to hear. I would prefer to do it myself rather than a module, but if there is an affordable module i might try it.

Thanks for the tip about the url, still learning little bits and peices in miva script.

As for the images, they are just temporary for the moment, i will move the images around when everything is sorted out and at the moment i am not using SSL, so it's not causing to much issues

Here's what it looks like right now

http://www.rhdev.com/example.png

Underneth add to cart it should have
Quantity Discount
- 5 pack $17.95
- 25 Pack $82.50

Etc, and clicking on the text will add a 5 pack product into your cart with the 17.95 price, etc

imnotinsane
11-01-06, 04:46 AM
Worked out what the problem is, because i am always working in advanced mode i miss a few things, like the little check boxes to activate a custom field. Kind of annoying, since as soon as you go to point and click mode and enable all the custom fields miva re-writes all your code and replaces it with the standard stuff.