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

Related products: with thb. + N column format + add to cart button.
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 10-23-2008, 12:40 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Related products: with thb. + N column format + add to cart button.

UPDATE 24-10-2008,
UPDATE 29-10-2008
(sql code)
UPDATE 22-01-2009 (sql code for xcart 4.1.9)

Little mode for Related Product on the detail product page:
a) a "PRODUCT THUMBNAIL PHOTO", will appear in related products
b) they can specify "HOW MANY PRODUCTS, WILL APPEAR" in related products (you can specify this option in the admin area)
c) allow for the "BUY NOW" BUTTON, to appear in related products (you can specify this option in the admin area)

---------------------------------

0. Backup mysql


1. Apply mysql patch:

Code:
insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', '', ''); insert into xcart_config VALUES ('related_num_column', 'Display related products list in multiple columns (leave empty to use standard format)', '3', 'Appearance', '5', 'text', '', '', ''); insert into xcart_config VALUES ('related_add_to_cart', 'Enable add to cart button for related products', 'N', 'Appearance', '6', 'checkbox', 'N', '', '');


for version x-cart 4.1.9:

Code:
insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', ''); insert into xcart_config VALUES ('related_num_column', 'Display related products list in multiple columns (leave empty to use standard format)', '3', 'Appearance', '5', 'text', '', ''); insert into xcart_config VALUES ('related_add_to_cart', 'Enable add to cart button for related products', 'N', 'Appearance', '6', 'checkbox', 'N', '');


2. Change file code for "skin1/modules/Upselling_Products/related_products.tpl"

PHP Code:
{* $Idrelated_products.tpl,v 1.15.2.1 2007/05/02 06:05:39 max Exp $ *}

{if 
$product_links ne ""}

{if 
$config.Appearance.related_num_column lte 0}
{
capture name=dialog}
<
table cellspacing="5">
{
section name=cat_num loop=$product_links}
<
tr class="ItemsList">
    <
td width="1%">#{$product_links[cat_num].productid}</td>
    
<td width="99%"><a href="product.php?productid={$product_links[cat_num].productid}"{if $config.Upselling_Products.upselling_new_window eq 'Y'target="_blank"{/if} class="ItemsList">{$product_links[cat_num].product|amp}</a></td>
</
tr>
{/
section}
</
table>
{/
capture}
{include 
file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra='width="100%"'}

{else}

{
capture name=dialog}

{
assign var="count_per_row" value=`$config.Appearance.related_num_column`}

{
math equation="floor(100/x)" x=$count_per_row assign="width"}
{
assign var="count" value=0}

<
table width="100%">
{
section loop=$product_links name=proid}
        {if 
$count is div by $count_per_row}
            <
tr>
            {
assign var="count" value=0}
        {/if}

        <
td width="{$width}%" height="100%" align="center" valign="top" >

            <
a href="product.php?productid={$product_links[proid].productid}class="ItemsList">{$product_links[proid].product}</a><br />
            <
a href="product.php?productid={$product_links[proid].productid}"{if $config.Modules.upselling_new_window eq 'Y'target="_blank"{/if}>
                {include 
file="product_thumbnail.tpl" productid=$product_links[proid].productid image_x=$config.Appearance.thumbnail_width tmbn_url=$product_links[proid].tmbn_url}
            </
a>
            <
br />
            <
font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$product_links[proid].taxed_price}</font>
            <
br /><br />
            {if 
$config.Appearance.related_add_to_cart eq "Y"}
                {if 
$config.General.unlimited_products eq "Y" || $product_links[proid].avail gt 0}
                    {include 
file="buttons/button.tpl" style="button" button_title=$lng.lbl_add_to_cart href="javascript: self.location='cart.php?mode=add&productid=`$product_links[proid].productid`&amount=1'"}
                {else}
                    <
b>{$lng.txt_out_of_stock}</b>
                {/if}
            {/if}
        </
td>

        {
capture name=prod_index}
            {
math equation="index+x+1" index=$count x=$count_per_row}
        {/
capture}
        
        {if 
$smarty.capture.prod_index is div by $count_per_row}
            </
tr>
            <
tr>
                <
td colspan="{$count_per_row}"><hr></td>
            </
tr>
        {/if}
        {
math equation="x+1" x=$count assign="count" }

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

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

{/if}
{/if} 


PS. Tested for xcart 4.1.9 - 4.1.11.
PS2. I would be grateful for any comments on that decision.

Product details page:
Click image for larger version

Name:	first.JPG
Views:	217
Size:	18.1 KB
ID:	1190

Admin area:
Click image for larger version

Name:	seond.JPG
Views:	140
Size:	16.5 KB
ID:	1191
Reply With Quote
  #2  
Old 10-23-2008, 08:50 PM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default Re: Related products: with thb. + N column format + add to cart button.

Smile... abbreviations in your thread title make it hard to read... it took me a few seconds to translate and see what you have done... but is great

Is cool you pass this finished RELATED PRODUCTS mod...
- so people can have their "Related Products" appear as:-
a) a "PRODUCT THUMBNAIL PHOTO", will appear in related products
b) they can specify "HOW MANY PRODUCTS, WILL APPEAR" in related products
c) allow for the "BUY NOW" BUTTON, to appear in related products

This is a great little mod, as I see lots of sites with boring "list of related products" - a list I personally thinks adds nothing (PHOTOS like in your mod achieves is just so much better!!!).

Great little mod Yurij and I am sure many forum members will benefit from it...
Your team is a great addition to the forum and does offer very useful coding advice.

Cheers - Asiaplay
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
Reply With Quote
  #3  
Old 10-24-2008, 04:27 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Related products: with thb. + N column format + add to cart button.

Quote:
Originally Posted by Asiaplay
Smile... abbreviations in your thread title make it hard to read... it took me a few seconds to translate and see what you have done... but is great

Is cool you pass this finished RELATED PRODUCTS mod...
- so people can have their "Related Products" appear as:-
a) a "PRODUCT THUMBNAIL PHOTO", will appear in related products
b) they can specify "HOW MANY PRODUCTS, WILL APPEAR" in related products
c) allow for the "BUY NOW" BUTTON, to appear in related products

This is a great little mod, as I see lots of sites with boring "list of related products" - a list I personally thinks adds nothing (PHOTOS like in your mod achieves is just so much better!!!).

Great little mod Yurij and I am sure many forum members will benefit from it...
Your team is a great addition to the forum and does offer very useful coding advice.

Cheers - Asiaplay

Thank you for message.
I used it for description this modification. )))

Yesterday i did not have time to write a description.
Reply With Quote
  #4  
Old 10-24-2008, 04:50 AM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default Re: Related products: with thb. + N column format + add to cart button.

No problem Yurji - know you are busy... your mod is cool (no surprises here, as can see you know x-cart code inside out)... so I just wanted to make sure, that new members understood what it does... as it is a useful mod, but also an easy one for everyone to implement if they want to...

All the best and cheers - Asiaplay
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
Reply With Quote
  #5  
Old 10-24-2008, 02:14 PM
 
bluecat bluecat is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 674
 

Default Re: Related products: with thb. + N column format + add to cart button.

Works great here, thank you. However, if I leave the number blank (under: Display related products list in multiple columns (leave empty to use standard format): it reverts back to 3 or the previous number entered. Is there a way to make these line up vertically with a partial description?

Thank you
__________________
--------------------
X-Cart Gold 4.1.11
Linux/Apache
--------------------
Reply With Quote
  #6  
Old 10-29-2008, 12:38 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Related products: with thb. + N column format + add to cart button.

Quote:
Originally Posted by bluecat
Works great here, thank you. However, if I leave the number blank (under: Display related products list in multiple columns (leave empty to use standard format): it reverts back to 3 or the previous number entered. Is there a way to make these line up vertically with a partial description?

Thank you

Yes. Try apply next mysql query:

PHP Code:
update  xcart_config set defvalue='' where name 'related_num_column'
Reply With Quote
  #7  
Old 01-13-2009, 11:22 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Related products: with thb. + N column format + add to cart button.

Kudos Yurji, Great job!

Awesome mod.

Thank you,
Christine
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #8  
Old 01-21-2009, 09:12 PM
  fmoses's Avatar 
fmoses fmoses is offline
 

Senior Member
  
Join Date: Apr 2008
Posts: 155
 

Default Re: Related products: with thb. + N column format + add to cart button.

I'm trying to install it on version 4.1.9 and got the follwing error when trying to apply patch

SQL PATCH FAILED AT QUERY:
insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', '', '')
Attached Thumbnails
Click image for larger version

Name:	untitled.JPG
Views:	31
Size:	107.6 KB
ID:	1334  
__________________
www.anythingindian.biz
X-Cart Pro 4.1.9
Reply With Quote
  #9  
Old 01-22-2009, 05:05 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Related products: with thb. + N column format + add to cart button.

Quote:
Originally Posted by fmoses
I'm trying to install it on version 4.1.9 and got the follwing error when trying to apply patch

SQL PATCH FAILED AT QUERY:
insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', '', '')



For version 4.1.9 use next MYSQL patch:
PHP Code:
insert into xcart_config VALUES ('sep001''Related product''''Appearance''4''separator''''');
insert into xcart_config VALUES ('related_num_column''Display related products list in multiple columns (leave empty to use standard format)''3''Appearance''5''text''''');
insert into xcart_config VALUES ('related_add_to_cart''Enable add to cart button for related products''N''Appearance''6''checkbox''N'''); 

PS. I have not tested on version below 4.1.11 (in 4.1.9 I think should work). If this does not work, I try to fix it later (for old version).
Reply With Quote
  #10  
Old 01-22-2009, 05:11 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Related products: with thb. + N column format + add to cart button.

I had the same error, though it was a quick fix as I realized I needed to make sure I had the correct fields in MYSQL database on our server. I also verified within my name field other instances of sep--, so I knew our database was on par with his query. Yurij's query is to update 9 fields in his database, but for my database I had only 8 fields. So I needed to remove one field from his query and it worked.

First verify in your MYSQL database the number of fields you have and that will determine the query string. For those who need help with understanding query structure: insert into xcart_config is inserting new data into the xcart_config table, then VALUES ('', '', '', '', '', '', '', ''); is indicating the query string to apply a value where each field is separated by single quote as 'field value name here' or '' (the '' will pass through without applying new information to that field). Here's how my query read:

insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', '');
insert into xcart_config VALUES ('related_num_column', 'Display related products list in multiple columns (leave empty to use standard format)', '3', 'Appearance', '5', 'text', '', '');
insert into xcart_config VALUES ('related_add_to_cart', 'Enable add to cart button for related products', 'N', 'Appearance', '6', 'checkbox', 'N', '');

Christine

Quote:
Originally Posted by fmoses
I'm trying to install it on version 4.1.9 and got the follwing error when trying to apply patch

SQL PATCH FAILED AT QUERY:
insert into xcart_config VALUES ('sep001', 'Related product', '', 'Appearance', '4', 'separator', '', '', '')
__________________
______________
version 4.1.9 Gold
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:17 PM.

   

 
X-Cart forums © 2001-2018