Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding Product Listing to Detailed Product Page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-23-2008, 07:56 PM
 
RobinThor RobinThor is offline
 

Member
  
Join Date: Mar 2008
Posts: 16
 

Default Adding Product Listing to Detailed Product Page

Hi I'm a new user to X-Cart, but I'll like to know how is it possible to have a product listing of the category at a detailed product page?

This is something like what I'm referring to : http://www.ahavaus.com/site/body_handcream.html

I'm not sure if I'm doing this right, but I think this would mean that I have to edit home.tpl to include the codes from products_t.tpl right? But I'm having a problem because home.tpl will know recognise the $product array variable from products.tpl or product_t.tpl.

Any help on this would be greatly appreciated!! Thanks a lot for your time!!
__________________
Vi8e Interactive

X-Cart Gold 4.1.9
Reply With Quote
  #2  
Old 03-24-2008, 03:21 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Adding Product Listing to Detailed Product Page

So you want to show all the products in a category at the product detail level?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 03-24-2008, 04:15 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Adding Product Listing to Detailed Product Page

Quote:
Originally Posted by RobinThor
Hi I'm a new user to X-Cart, but I'll like to know how is it possible to have a product listing of the category at a detailed product page?

This is something like what I'm referring to : http://www.ahavaus.com/site/body_handcream.html

I'm not sure if I'm doing this right, but I think this would mean that I have to edit home.tpl to include the codes from products_t.tpl right? But I'm having a problem because home.tpl will know recognise the $product array variable from products.tpl or product_t.tpl.

Any help on this would be greatly appreciated!! Thanks a lot for your time!!

For version 4.1.9, I would have done so:

In the file "product.php" insert the following lines (before - "# Assign the current location line"):
PHP Code:
$allproduct = array();
$allproduct func_query ("SELECT * FROM $sql_tbl[products]$sql_tbl[products_categories] WHERE $sql_tbl[products].productid=$sql_tbl[products_categories].productid AND $sql_tbl[products].forsale='Y' $avail AND $sql_tbl[products_categories].categoryid='$cat'");
$smarty->assign("allproduct"$allproduct); 


In the end file "skin1\customer\main\product.tpl" insert the following lines:
PHP Code:
<br>
{
capture name=dialog}
{
assign var="count_per_row" value=3}
<
table border=0 width=100%>
{
math equation="floor(100/x)" x=$count_per_row assign="width"}
{
section loop=$allproduct name=ind}

{if %
ind.indexis div by $count_per_row}
<
tr>
    {
assign var="cell_counter" value=0}
{/if}
    {
math equation="x+1" x=$cell_counter assign="cell_counter" }

<
td valign=top  align=center width={$width}%>
<
table border=0>
    <
tr>
        <
td align=center>

            {include 
file="product_thumbnail.tpl" productid=$allproduct[ind].productid image_x=$allproduct[ind].tmbn_x|default:$config.Appearance.thumbnail_width image_y=$allproduct[ind].tmbn_y product=$allproduct[ind].product tmbn_url=$allproduct[ind].tmbn_url}
        </
td>
    </
tr>
    <
tr>
        <
td>
            <
a href="product.php?productid={$allproduct[ind].productid}&amp;cat={$cat}class="ProductTitle">{$allproduct[ind].product}</a>
        </
td>
    </
tr>
</
table>

</
td>

{
capture name=prod_index}
    {
math equation="index+x+1" index=%ind.indexx=$count_per_row}
{/
capture}


{if 
$smarty.capture.prod_index is div by $count_per_row}
    </
tr>
{/if}
{/
section}

    {if 
$cell_counter lt $count_per_row}
    {
section name=rest_cells loop=$count_per_row start=$cell_counter}
        <
td class="SectionBox">&nbsp;</td>
    {/
section}
    {/if}
</
tr>
</
table>


{/
capture}
{include 
file="dialog.tpl" title="All products" content=$smarty.capture.dialog extra='width="100%"'

Result:

Click image for larger version

Name:	forum_1.JPG
Views:	221
Size:	30.6 KB
ID:	852

{assign var="count_per_row" value=3} - Specifies the number of products displayed in a row.
Reply With Quote
  #4  
Old 03-24-2008, 08:43 AM
 
RobinThor RobinThor is offline
 

Member
  
Join Date: Mar 2008
Posts: 16
 

Default Re: Adding Product Listing to Detailed Product Page

Hi Yurij,

Thanks a lot! It works! One more question: Supposing you want to have multiple pages on the product listing? What additional code will you need to add?
__________________
Vi8e Interactive

X-Cart Gold 4.1.9
Reply With Quote
  #5  
Old 03-25-2008, 12:12 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Adding Product Listing to Detailed Product Page

At a detailed product page? Or where?
Reply With Quote
  #6  
Old 03-25-2008, 06:45 PM
 
RobinThor RobinThor is offline
 

Member
  
Join Date: Mar 2008
Posts: 16
 

Default Re: Adding Product Listing to Detailed Product Page

Hi Yurij,

For the multiple pages for the products listing. I actually amended a bit of your code, so now the product listings will be reflected on the right column. But what if there are too many products in the category and I'll like to have a page selector?
__________________
Vi8e Interactive

X-Cart Gold 4.1.9
Reply With Quote
  #7  
Old 03-26-2008, 12:36 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Adding Product Listing to Detailed Product Page

I see no sense in that.
In this unit output products for selected product categories.
The same, we will see if we select the product category (with page navigation).

Maybe it makes sense to withdraw the first 5-10 products, and then to link at the bottom (View all product), which will rely on the product category.
Reply With Quote
  #8  
Old 04-01-2008, 07:51 AM
 
ben@lrb.co.uk ben@lrb.co.uk is offline
 

Member
  
Join Date: Feb 2006
Posts: 29
 

Default Re: Adding Product Listing to Detailed Product Page

Yurij,

I'm really interested in doing something similar to this, but to display all products in a specific category in a little table on the homepage, rather than in every product template.

Do you think this could be done by adapting your code, and if so what would I need to alter?

Many thanks,

Rachael
__________________
--
X-cart Version 4.1.9
Reply With Quote
  #9  
Old 04-02-2008, 12:09 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Adding Product Listing to Detailed Product Page

Look at this:

http://forum.x-cart.com/showthread.php?t=38250
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:16 AM.

   

 
X-Cart forums © 2001-2020