What would be really nice is if 3dcart had <% DRAW %> functions like MC.
This:
Code:
<table>
<tr>
<td> <% DRAWREVIEWS %>
</td>
</tr>
</table>
Would make something like this:
Code:
<table>
<tr>
<td><!--START: reviews-->
<p>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td class="font1" colspan=2><b>[reviews_total] [totalrating]</b></td>
<td colspan=2 class="font1" align=right>[review_link]</td>
</tr>
<tr>
<td colspan="4" class="titles"> [reviews_header]</td>
</tr>
<!--START: user_reviews-->
<tr>
<td class="font1" width=80 align=left><b><img src="assets/templates/common/images/star[rating].gif"></b></td>
<td class="font1">[short_review]</td>
<td class="font1"> </td>
<td class="font1" align=right>[review_date]</td>
</tr>
<tr>
<td class="font1" width=80>Reviewed by:</td>
<td class="font1" colspan=3 align=left><b>[user_name]</b> from [user_city].
<!--START: user_email-->
<a href="mailto:[user_email]">[user_email]</a>
<!--END: user_email-->
</td>
</tr>
<tr>
<td class="font1" colspan=4>[long_review]</td>
</tr>
<!--END: user_reviews-->
</table>
<!--START: create_review_link-->
<a href='product.asp?itemid=[itemid]&action=all'>[reviews_new]</a>
<!--END: create_review_link-->
<!--END: reviews-->
<!--START: create_first_review-->
<a href='product.asp?itemid=[itemid]&action=all'>[reviews_first]</a>
<!--END: create_first_review-->
<!--START: create_review-->
<p>
<form name=creview method=post action="review.asp?action=create&catalogid=[catalogid]">
<table width="100%" cellpadding="2" cellspacing="0" border="0" ID="Table1">
<tr>
<td colspan="4" class="titles"> [reviews_add]</td>
</tr>
<tr>
<td width="11%" class="price-info">Name:</td>
<td width="41%" class="price-info"><input type=text name=user_name ID="Text2" maxlength=50 class="txtBoxStyle">
<img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
<td width="6%" class="price-info">Email:</td>
<td width="42%" class="price-info"><input type=text name=user_email ID="Text3" maxlength=50 class="txtBoxStyle">
<img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
</tr>
<TR>
<td class="price-info">Location:</td>
<td class="price-info" colspan=3><input type=text size=58 name=user_city ID="Text1" maxlength=50 class="txtBoxStyle">
<img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
</TR>
<tr>
<td class="price-info">Title:</td>
<td class="price-info" colspan=3 align=center><P align=left>
<input type=text size=58 name=short_review maxlength=100 ID="Text4" class="txtBoxStyle">
<img src="assets/templates/common/images/error2.gif" width="12" height="12"></P></td>
<tr>
<tr>
<td class="price-info">Review:</td>
<td colspan=3><textarea cols=44 name=long_review class="txtareaStyle"></textarea>
<img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
</tr>
<tr>
<td class="price-info">Rating:</td>
<td class="price-info" colspan=3 align=center><input type=radio name=rating value=1> <img src="assets/templates/common/images/star1.gif"> <input type=radio name=rating value=2 ID="Radio1"> <img src="assets/templates/common/images/star2.gif"> <input type=radio name=rating value=3 ID="Radio2">
<img src="assets/templates/common/images/star3.gif"> <input type=radio name=rating value=4 ID="Radio3">
<img src="assets/templates/common/images/star4.gif"> <input type=radio name=rating value=5 ID="Radio4" checked>
<img src="assets/templates/common/images/star5.gif"> </td>
</tr>
<tr>
<td class="price-info" colspan=4 align=center><input type=submit value="Add Review" class="btn"></td>
</tr>
<tr>
<td colspan="4"><span class="error"><img src="assets/templates/common/images/error2.gif"> = Required</span></td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
var frmvalidator = new Validator("creview");
frmvalidator.setAddnlValidationFunction("submitForm");
frmvalidator.addValidation("user_name","req","Please enter your First and Last Name.");
frmvalidator.addValidation("user_name","maxlen=40","Max length for Name is 40.");
frmvalidator.addValidation("user_city","req","Please enter your City.");
frmvalidator.addValidation("user_city","maxlen=50","Max length for City is 50.");
frmvalidator.addValidation("user_email","maxlen=50","Max length for Email is 50.");
frmvalidator.addValidation("user_email","email");
frmvalidator.addValidation("user_email","req","Please enter your E-mail.");
frmvalidator.addValidation("long_review","maxlen=500","Max length for Name is 500.");
frmvalidator.addValidation("long_review","req","Please enter your review.");
frmvalidator.addValidation("short_review","maxlen=100");
frmvalidator.addValidation("short_review","req","Please enter your review.");
</script>
<!--END: create_review-->
</td>
</tr>
</table>
If you were new, which one would you use? If you didn't know anything about coding?
One quick variable would insert all the code automatically when the page is rendered. Yes, there is more flexibility editing the template directly, but sometimes less advanced users may want to move things around without knowing how to code.
I think there should be 3 levels available:
1- edit styles and position in the admin panel (existing)
2- create a simple table on a page in the admin panel and insert a few <% DRAW %> functions around in the cells for a custom layout
3- edit the template file directly, manipulating each individual element to your needs (existing)
I am learning how to manipulate the template directly, but I am finding that there is a steep learning curve. Some of the things that need to be changed assumes that you know why that particular statement is there in the first place.
I just realized recently that the comment statements are necessary too. Why would a comment statement matter? I don't know but they do. And if they don't, then I am doing something wrong and proves my point anyway.
Am I wrong or off base? Lets discuss this too.