Author |
Topic |
|
rgoetz
Starting Member
USA
29 Posts |
Posted - August 31 2004 : 19:11:22
|
Hello all, I contracted with a developer to create a quantity discount table that pulls the information from the Quantity table and puts it into a table on the product page. This person created the code, sent the file (shopfolio), and told me to contact him if I required additional assistance with formatting etc.
The code worked in the sample file, but when I put it into my tmp_product file, the product information moved to the bottom and the related products was lost.
Unfortunately, this developer will not return my emails or refund my purchase. So I am turning to you. Can someone look at the code that was written to tell me what may be wrong with it? My client really needs this feature.
Here is the shopfoleio piece: Sub Handle_Quantitydiscounts(value,parsearray,parseRS) if getconfig("xquantityPrices")<>"Yes" then exit sub dim customertype customertype=getsess("customertype") if lcase(customertype)<>"level-1" then exit sub dim lookupsql, lookuprs, oldprice, newprice, iprice, discount, i dim quantitylowfield, quantityhighfield, quantitylow, quantityhigh, pricefield Dim Discountamount,DiscountPercent dim catalogid, categoryid, price, discountprice, discpercent dim fieldvalue catalogid=parsers("catalogid") categoryid=ParseRs("ccategory") lookupsql="select * from quantitydiscounts " lookupsql = lookupsql & " where catalogid=" & catalogid lookupsql = lookupsql & " or categoryid=" & categoryid 'debugwrite "lookupsql=" & lookupsql Set lookuprs=dbc.execute(lookupsql) if lookuprs.eof then lookuprs.close set lookuprs=nothing exit sub end if shopwriteheader getlang("LangProductDiscount") response.write ReportTableDef & ReportHeadRow Response.write ReportHeadColumn & getlang("LangProductQuantity") & ReportHeadColumnEnd Response.write ReportHeadColumn & getlang("LangProductPrice") & ReportHeadColumnEnd response.write ReportRowEnd newprice=Parsers("cprice") price=newprice ShopCustomerPrices ParseRS, catalogid, categoryid, iprice, newprice,discount for i = 1 to 5 If i=1 then quantitylowField= "minquantity" else quantitylowField= "quantity" & i-1 end if quantityhighfield="quantity" & i pricefield="discount" & i Quantitylow= lookuprs(quantitylowfield) quantityhigh=lookuprs(quantityhighfield) If isnull(quantityhigh) then exit for If quantityhigh=0 then exit for If I <5 then quantityhigh=quantityhigh-1 end if fieldvalue= quantitylow & " to " & quantityhigh response.write reportdetailrow response.write ReportDetailColumn & fieldvalue & ReportDetailcolumnEnd discpercent=lookuprs(pricefield) If discpercent>=1 then discount=discpercent else discount=Price*discpercent end if 'debugwrite "discountpercent=" & discpercent DiscountPrice=Price-discount DiscountPrice=shopformatcurrency(Discountprice,getconfig("xdecimalpoint")) response.write ReportDetailColumn & discountprice & ReportDetailcolumnEnd response.write "</tr>" next response.write "</table>" end sub
Here is my tmp_product file <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <div align="center"> <table border="0" cellspacing="0"> <tr> <td colspan="2"> <h2 align="center" style="margin-top: 0; margin-bottom: 0"><font face="arial" size="2" color="#1A3E8A"><b>[cname]</b></font></h2> </td> </tr> </center> <tr> <td width="32%" align="left" valign="top"> </td> <td width="68%" align="left"> </td> </tr> <tr> <td width="32%" align="left" valign="top"> <p> <b> <font face="arial" size="5" color="#C00505">Price:</font></b></p> </td> <td width="68%" align="left"> <font face="arial" color="black"> <b> [formatcurrency cprice] </b></font> </td> </tr> <center> <tr> <td width="32%" align="left" valign="top"> <b> <font face="arial" size="5" color="#1A3E8A">Shipping:</font></b></td> <td width="68%" align="left"> <b> <font face="arial" color="black"> [formatcurrency weight]</font><font face="arial" color="#C00505"> [pother1] </font> </b> </td> </tr> <tr> <td width="50%" align="left"><font face="arial" size="2" color="black"> Item#</font></td> <td width="50%" align="left"><font face="arial" size="2" color="black"> [ccode]</font></td> </tr> </center> </table> </div> </td> <td width="33%"> $<p align="left"><img border="0" src="images\[extendedimage]"><p align="left"> </td> </tr> <tr> <td width="100%" colspan="2"> <b><font color="#008000">[pother4]</font></b></td> </tr> <tr> <td width="100%" valign="top" colspan="2"> </td> </tr> <tr> <td width="100%" valign="top" colspan="2"> [add_formstart]</td> </tr> </table> <hr> <table border="0" cellpadding="2" style="border-collapse: collapse" width="100%" bordercolorlight="#008080" bordercolordark="#95CECD" id="table1"> <tr> <td valign="top">[add_productfeatures]<p>[add_orderbutton] <p>[add_product]</p> <p>[add_formend] </p> $ <p align="left">[level3]</p> $ <p><a href="[pother2]"> <img src="images/buttons/pole.gif" width="100" height="35" border="0"></a> $ <p><a href="[pother3]"><img src="images/buttons/colors.gif" width="100" height="35" border="0"></a> </td> <p> </table> <p> <font face="arial" size="2" color="black">[cdescription]</font></p> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="table2"> <tr> <td width="100%"> <font face="arial" size="3" color="black">[extendeddesc]</font></td> </tr> </table> <p><u>[add_crossselling] </u></p> <p>[ADD_PageTrailer]
</p>
I need a table that shows the Quantity and the discount that goes with it.
Thanks, Rhonda
Rhonda Goetz, CIW-CI http://esitecreations.com |
|
Dulrr
VP-CART New User
57 Posts |
Posted - September 01 2004 : 15:12:57
|
Well, I can't say anything certain offhand, but from a quick glance I'm guessing that the </tr> and/or the </table> tag found at the end of shopfoleio may be the problem. Prematurely closing tables and rows can do all sorts of weird things to the way a web page will display!
If you go to "View Source" when testing the page in question I'm guessing that the "Related Products" will appear lost somewhere in the source and that the order of display will appear to be correct. If this is the case, try commenting out the Response.Write("</tr>") and Response.Write("</table>")
Good luck!
~D
PS: You can preserve the indentations of your code by enclosing text in the [code] tags. The "#" button in the "Format" row (above message body) when writing a post is a quick way to add said tag.
~D |
|
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - September 01 2004 : 16:19:45
|
The html tables/rows that the templates use by default like this for these kinds of functions are horribly complex and awkward when you want to build and debug changes like this.
We needed exactly the same thing a while ago ("display qty-discounts table" in the templates), and we ended up just creating a set of brand-new functions that you can call in any of the template files by using extra template-fields.
eg: [FORMAT_PRODUCT_QTY_TABLE_ROWS_DISCOUNT catalogid] to display the qty-discount-table in a row format
[FORMAT_PRODUCT_QTY_TABLE_COLUMNS_DISCOUNT catalogid] to display the qty-discount-table in a column format etc
6 functions/fields altogether are available, showing prices, discounts, or both, and all of those in column or row format.
They can also be called in asps as normal functions, and not just in templates.
We haven't released this for sale yet, but that's only because we havn't documented a readme file for it yet.
If you have a look at:
http://www.chesshouse.com/shopexd.asp?id=3401
you'll see this in action
(this example uses the "COLUMN" template field, so the discounts go across; you can also use the "ROW" template field so it shows in rows instead)
If this is the kind of thing that you're after, feel free to email me and we'll finalise what the price of this addon will be when it goes for sale and then you can get it all in-place nice and easily.
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
|
|
rgoetz
Starting Member
USA
29 Posts |
Posted - September 01 2004 : 17:42:13
|
If you go to "View Source" when testing the page in question I'm guessing that the "Related Products" will appear lost somewhere in the source and that the order of display will appear to be correct. If this is the case, try commenting out the Response.Write("</tr>") and Response.Write("</table>")
Yes I will try that. Thanks for your input!
Rhonda Goetz, CIW-CI http://esitecreations.com |
|
|
rgoetz
Starting Member
USA
29 Posts |
Posted - September 04 2004 : 21:47:40
|
Well my quantity discount problem is solved! Thanks BigYellowZone for supplying code that actually works! Thanks Simon for all your help. Rhonda
Rhonda Goetz, CIW-CI http://esitecreations.com |
|
|
|
Topic |
|