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

Newest Products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #181  
Old 07-07-2007, 11:09 AM
 
LisaB LisaB is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 74
 

Default Re: Newest Products

Quote:
Originally Posted by lapidarist
I modified the code to:


Hopefully this will fix some problems.

Awesome! Thanks
__________________
XCart Version 4.1.6
PHP 4.4.4
MySQL 4.1.21-standard
Reply With Quote
  #182  
Old 07-07-2007, 03:00 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default Re: Newest Products

I get this error when I click on any Products added since: variant

Warning: Smarty error: math ``x/y'' in ``customer/home.tpl'': parameter ``y'' is empty in /home/xxxxx/public_html/demo/Smarty-2.6.12/Smarty.class.php on line 1095

Can anyone help
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #183  
Old 07-16-2007, 09:19 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default Re: Newest Products

Works well now

The patch in the func file did the trick

thanks
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #184  
Old 07-17-2007, 03:52 AM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default Re: Newest Products

Just noticed that the product short description does not show
Would be great if it did
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #185  
Old 07-18-2007, 06:59 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Newest Products

OK, it all seems to be working fine.... except...

When I click on "New Products Added: 24 Hours" on the newproducts page I get the by now familiar "Warning: array_slice() [function.array-slice]: The first argument should be an array in /home/xxxx/public_html/xcart/newproducts.php on line 153" error. Is anyone else also getting this error?

My bad... I accidentally replace newproducts.php with the original upgraded version. When I used the latest one it worked fine. Just to make sure no one else has the same problem I have uploaded the latest version.
Attached Files
File Type: zip newproducts4-1-x.zip (4.7 KB, 280 views)
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #186  
Old 07-22-2007, 06:29 PM
 
pavant pavant is offline
 

Advanced Member
  
Join Date: Oct 2004
Location: Chicago, Illinois
Posts: 84
 

Default Re: Newest Products

I love this mod but it wasn't set up for 4.1.x versions of xcart so I tried to make it work with my 4.1.8. I have it set to show new products added within the last 90 days on the home page only. Here is what I have so far:

1. Create file newest.php in the xcat home directory.
PHP Code:
<?php
#
# $Id: newest.php 2007/07/22 $
#
// set variables
$daterange 7776000// 60 * 60 * 24 * 90 days in unix time
$nowtime time();
$oldtime $nowtime $daterange ;
 
# Get new products data and store it into $newproducts array
#
if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }
#
# Select from products table
#
$user_account['membershipid'] = !empty($user_account['membershipid'])?$user_account['membershipid']:0;
$old_search_data $search_data["products"];
$old_mode $mode;
$old_page $page;
$search_data["products"] = array();
$search_data["products"]["forsale"] = "Y";
$search_data["products"]["avail"] = "> 0";
$search_data["products"]["add_date"] = "> " $oldtime "";
$search_data["products"]["add_date"] = "< " $nowtime "";
$search_data["products"]["sort_condition"] = "$sql_tbl[products].add_date DESC";
$REQUEST_METHOD "GET";
$mode "search";
include 
$xcart_dir."/include/search.php";
$search_data["products"] = $old_search_data;
x_session_save("search_data");
$mode $old_mode;
$page $old_page;
unset(
$old_search_data$old_mode$old_page);
$smarty->clear_assign("newproducts");
$smarty->assign("newproducts",$products);
$search_data '';
$products = array();
unset(
$search_data$products);
?>
2. Modify file home.php in the xcart home directory to add code for newest.php

PHP Code:
if (empty($products)) {
include 
"./featured_products.php";
}
if (empty(
$products) and empty($current_category)) {
include 
"./newest.php";



3. Modify statement in the home_main.tpl template in the skin1/customer directory to read as follows:

{elseif $main eq "catalog" && $current_category.category eq ""}
{include file="customer/main/welcome.tpl" f_products=$f_products newproducts=$newproducts}


4. Create newest.tpl template in the /skin1/customer/main directory.

{* $Id: newest.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *}
{capture name=dialog}
{if $newproducts ne ""}
{include file="customer/main/products.tpl" products=$newproducts}
{/if}
{/capture}
{include file="dialog.tpl" title="New Products" content=$smarty.capture.dialog extra="width=100%"}



5. Modify the welcome.tpl template in the /skin1/customer/main directory.

{if $f_products ne ""}
{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}


I hope this helps some of the xcart 4.1 sites. I make no promises that this code will work with your site; each environment is different and your code may function differently especially if it has already been moded. I can't provide any support for this mod. Install only if you have the resources to fix any problems that may occur.
__________________
X-Cart Gold v 4.1.10
PHP 5.2.4
MySQL 5.0.45 standard
Apache/2.2.6
OS - Linux
Reply With Quote

The following user thanks pavant for this useful post:
fearnothing (01-08-2010)
  #187  
Old 07-23-2007, 02:53 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default Re: Newest Products

After installing this mod all I get is the PHP file showing at the top of the home page
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #188  
Old 07-24-2007, 10:00 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Newest Products

Quote:
Originally Posted by yages
After installing this mod all I get is the PHP file showing at the top of the home page

Did you use the zip file, or the mod directly above your post? They do two different things.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #189  
Old 07-24-2007, 11:55 AM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default Re: Newest Products

I have installed both mods. The php showed up on the mod directly above the post
Do you know how to make the product description and discounted prices show on the zipfile mod
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #190  
Old 07-25-2007, 07:14 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Newest Products

Quote:
Originally Posted by yages
I have installed both mods. The php showed up on the mod directly above the post
Do you know how to make the product description and discounted prices show on the zipfile mod

Both mods? Don't you think that will be confusing? The one in the zip file is the one I use. It uses a template (newproducts.tpl) and is called on a separate page by putting a link to newproducts.php anywhere. I don't know about the other mod.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
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 04:08 AM.

   

 
X-Cart forums © 2001-2020