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

Random Featured Products using Recommended Products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 02-12-2009, 03:23 PM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default Re: Random Featured Products using Recommended Products

Quote:
Originally Posted by benz
To go back to the very original post, if you just want to show featured products in a random way you can modify featured_products.php to shuffle the array before assigning it to smarty.

Near the end of featured_products.php just add the line:
PHP Code:
shuffle($products); 
immediately before the line:
PHP Code:
$smarty->assign("f_products",$products); 


Are you saying that that one line of code will display a random featured products list from all my products?
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #32  
Old 02-13-2009, 02:20 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Random Featured Products using Recommended Products

This one line of code will display random featured product list from your featured products list of the current category only.
Reply With Quote
  #33  
Old 02-13-2009, 02:35 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Random Featured Products using Recommended Products

any one got this mod any more i keep getting erros
Error: Smarty error: [in modules/Recommended_Products/recommends_home.tpl line 1]: syntax error: unrecognized tag: \rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{ \f0\fswiss\fcharset0 Arial; (Smarty_Compiler.class.php, line 446) in /var/www/html/crazyleds/Smarty-2.6.19/Smarty.class.php on line 1092

error goes when i delete the text added to welcome.tpl
__________________
Version 5.3.1
Reply With Quote
  #34  
Old 02-13-2009, 02:47 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Random Featured Products using Recommended Products

ok got rid of that error now it was because i had products in feature products) i,.e manually added) but now its not showing this mod up at all enabled in admin section ther recommend products but am not getting any thing
http://www.crazyleds.co.uk/crazyleds/home.php
__________________
Version 5.3.1
Reply With Quote
  #35  
Old 02-13-2009, 04:36 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default Re: Random Featured Products using Recommended Products

Quote:
Originally Posted by Yurij
This one line of code will display random featured product list from your featured products list of the current category only.


hi Yurij,

I added the
PHP Code:
shuffle($products); 
line, but all it did was give me a "Featured products" box above the normal "Products", but both boxes contained the same products.

Is there any way to make the mod in this thread work for v4.2.x on the home page?

Thanks!
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #36  
Old 02-14-2009, 10:23 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Random Featured Products using Recommended Products

any one help?
__________________
Version 5.3.1
Reply With Quote
  #37  
Old 02-16-2009, 05:47 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Random Featured Products using Recommended Products

Show me where you’ve inserted the code and the code that you’ve inserted.
Reply With Quote
  #38  
Old 02-16-2009, 06:08 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Random Featured Products using Recommended Products

In customer/main/welcome.tpl
Code:
{* $Id: welcome.tpl,v 1.28.2.3 2008/07/15 12:07:40 ferz Exp $ *} {if ($active_modules.Greet_Visitor ne "") and ($smarty.cookies.GreetingCookie ne "") and $logout_user eq ''} {assign var="_name" value=$smarty.cookies.GreetingCookie|replace:"\'":"'"} <h3>{$lng.lbl_welcome_back|substitute:"name":$_name} </h3> {elseif $lng.lbl_site_title} <h3>{$lng.lbl_welcome_to|substitute:"company":$lng.lbl_site_title}</h3> {else} <h3>{$lng.lbl_welcome_to|substitute:"company":$config.Company.company_name}</h3> {/if} {$lng.txt_welcome} <br /> {if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} <br /> {if $f_products ne ""} {if $active_modules.Recommended_Products ne ""} {include file="modules/Recommended_Products/recommends_home.tpl" } {/if} {*{include file="customer/main/featured.tpl" f_products=$f_products}*} {/if} {if $newproducts ne ""} {include file="customer/main/newest.tpl" newproducts=$newproducts} {/if} {if $f_products eq "" && $newproducts eq ""} <img src="{$ImagesDir}/customer_images/welcome.jpg" alt="" /> {/if}


skin1/modules/Recommended_Products/

Code:
{* $Id: recommends_home.tpl,v 1.9 2006/09/25 14:51:45 hhiker Exp $ *} {if $recommends} {capture name=recommends} {include file="customer/main/products.tpl" products=$recommends} {/capture} {include file="dialog.tpl" title=$lng.lbl_recommends_home content=$smarty.capture.recommends extra='width="100%"'} {/if}

my home.php

Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2008 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2008 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: home.php,v 1.10.2.3 2008/04/11 18:09:11 osipov Exp $ # define('OFFERS_DONT_SHOW_NEW',1); // WCM - CDSEO Pro Links #require "./auth.php"; require_once "./auth.php"; include $xcart_dir."/modules/cdseolinks/cdseo_redirects.php"; // / WCM - CDSEO Pro Links require $xcart_dir."/include/categories.php"; if ($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; if (!empty($cat)) include "./products.php"; if (empty($products)) include "./featured_products.php"; if(!empty($active_modules["Recommended_Products"])) include "./recommends.php"; if ($active_modules["Bestsellers"]) include $xcart_dir."/modules/Bestsellers/bestsellers.php"; if ($active_modules["Random_Products"]) include $xcart_dir."/modules/Random_Products/randoms.php"; if (!empty($current_category) and is_array($current_category["category_location"])) { foreach ($current_category["category_location"] as $k => $v) $location[] = $v; } if (!empty($active_modules["Special_Offers"])) { include $xcart_dir."/modules/Special_Offers/category_offers.php"; } if (empty($products)) { include "./featured_products.php"; } if (empty($products) and empty($current_category)) { include "./newest.php"; } # Deleting the previously saved user information received from PayPal (Is performed when the user exits the checkout process) if (x_session_is_registered("paypal_token") || x_session_is_registered("paypal_express_details")) { x_session_unregister('paypal_token'); x_session_unregister("paypal_express_details"); } # # Assign Smarty variables and show template # $smarty->assign("main","catalog"); # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>

this is my code nd i just get nothing
__________________
Version 5.3.1
Reply With Quote
  #39  
Old 02-19-2009, 07:03 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default Re: Random Featured Products using Recommended Products

Quote:
Originally Posted by Yurij
Show me where you’ve inserted the code and the code that you’ve inserted.


Hi Yurij,

I added
PHP Code:
shuffle($products); 
just before the
PHP Code:
$smarty->assign("f_products",$products); 
line in the featured_products.php as you instructed.

Perhaps I missed something?
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #40  
Old 02-20-2009, 04:42 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Random Featured Products using Recommended Products

Quote:
Originally Posted by delboy2028
any one got this mod any more i keep getting erros
Error: Smarty error: [in modules/Recommended_Products/recommends_home.tpl line 1]: syntax error: unrecognized tag: \rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{ \f0\fswiss\fcharset0 Arial; (Smarty_Compiler.class.php, line 446) in /var/www/html/crazyleds/Smarty-2.6.19/Smarty.class.php on line 1092

error goes when i delete the text added to welcome.tpl
Seems like you have copied this text(code)into Word.

Create the file modules/Recommended_Products/recommends_home.tpl using Notepad or other editor for plain text.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 07:15 AM.

   

 
X-Cart forums © 2001-2020