Subproduct code

Questions and answers about ShopSite Custom Templates

Subproduct code

Postby Kapitol » Fri Jun 01, 2012 8:56 am

I need access to this specific subproduct code.
Code: Select all
<table class="Product">
  <tbody>
    <tr>
      <td valign="top" class="ProductGraphicLeft"><img width="221" vspace="2" hspace="2" height="118" border="0" alt="BangGoldnShadw.JPG" src="http://www.artandsoulbeads.com/store/media/Kits/BangGoldnShadw.JPG"></td>
      <!-- This closes the product graphic cell -->
      <td valign="top" class="ProductText"><!-- This opens the text cell -->
       
        <table cellspacing="0" cellpadding="0" border="0">
          <tbody>
            <tr><!-- Start of ROW -->
              <td><input type="checkbox" value="772" name="itemnum">
                &nbsp;
                Crystal Bangle Bracelet Kit: Crystal Golden Shadow - Gold Finish  &nbsp; <b>$55.00</b></td>
            </tr>
            <!-- END OF ROW -->
            <tr> <!-- Start OF Next ROW -->
              <td><input type="checkbox" value="774" name="itemnum">
                &nbsp;
                Crystal Bangle Bracelet Kit: Crystal Golden Shadow - Silver Finish&nbsp; <b>$48.00</b></td>
            </tr>
            <!-- Last One -->
          </tbody>
        </table></td>
      <!-- Close cell for product name and description -->
    </tr>
  </tbody>
</table>

I can replace the TABLE with a UL but what I end up with is the IMAGE inside the ProductGraphicLeft TD and the information which would be inside of the ProductText TD outside and displaying in LI's without being inside a UL. You can see an example on this page, http://www.artandsoulbeads.com/store/crystal_bangle_crystal_bracelet_kits.html - find Crystal Bangle Bracelet Kit: Custom Color and view it's source.

Ideally I would like to define the subproduct area without the use of a TABLE. But thus far I have been unable to locate an example of defined subproduct code I could use as an example.
My current code looks like this
Code: Select all
[-- IF PRODUCT.Subproduct --]
<ul>
[--LOOP SUBPRODUCTS 1 --]
<li>[--SUBPRODUCTS--]</li>
[--END_LOOP SUBPRODUCTS--]
</ul>
[-- ELSE --]

In the [-- DEFINE SUBPROUCT --] at the top of the page there is no TABLE named Product, no IMAGE being defined in a TD and no Product information being defined in a TD.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Subproduct code

Postby Jim » Fri Jun 01, 2012 10:04 am

Edit-looks like some stuff got chopped out of my original reply so I added it back in.
To do some testing on this to find out exactly what is output by the various tags I created very basic product and page templates as show here.
Code: Select all
[-- DEFINE SUBPRODUCT --]
[-- product.name --]&nbsp; [-- product.price --] <br>
[-- END_DEFINE SUBPRODUCT --]

[-- DEFINE PRODUCT --]
<p>
[-- product.name --]
<p>
[-- if product.subproducts --]
 [-- loop subproducts --]
    [-- subproducts --]
 [-- end_loop subproducts --]
[-- else --]
   <br> no subproducts <br>
[-- end_IF --]
[-- END_DEFINE PRODUCT --]

Here is my page template
Code: Select all
[-- DEFINE PAGE --]
<html>
[-- page.name --]
[-- loop products --]
  [-- product --]
[-- end_loop products --]
</html>
[-- END_DEFINE PAGE --]

And here is the html for the page that is generated for a product with 4 sub products. (note I deleted blank lines to make it shorter in the post)
Code: Select all
<html>
page for prod 
<!-- rec 1 -->
<a name="1"></a>
<p>
ASD<p>
three&nbsp; $3.00 <br>
one&nbsp; $1.00 <br>
four&nbsp; $4.00 <br>
two&nbsp; $2.00 <br>
</html>


As you can see there are no table tags output at all in this situation.

The table tags will be added automatically when you specify the number of columns of products to display using the [-- loop products NUMCOL --] tag. This is because the code must generate a table to know how many items are on a row and when to start the next row.

You can get around this by not using the number of columns option in the tag and manage the output of the items in the row yourself using a VAR to keep track of how many items have been output and add your code to force the next row at the appropriate place. I'm pretty sure that I have posted code to do something like that before to the forum so you might do a search and see if you can find the code I used.

The page template can also output content around the products by putting it before the [-- loop products --] tag, before and after the [-- products --] tag and after the [-- end_loop products --] tag. So make sure you check the page template for this also.

Note: this testing was done using ShopSite 11sp2, I don't know if any changes were made in this regard from previous version or not.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 122 guests