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
  #171  
Old 06-16-2007, 04:53 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: Newest Products

Any one please share the complete working code for version 4.1.7 ?

I was using it with version 4.0.12 but as now I have upgraed to latest version the original code doesn't work.
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #172  
Old 06-16-2007, 08:05 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 anandat
Any one please share the complete working code for version 4.1.7 ?


That would be nice but I don't think there is a working code for the 4.1.x version. It is the major reason we have not upgraded.
__________________
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
  #173  
Old 06-16-2007, 02:56 PM
  august's Avatar 
august august is offline
 

Senior Member
  
Join Date: Jul 2003
Posts: 178
 

Default Re: Newest Products

Maybe Phil from http://www.xcartmods.co.uk/ can help...
__________________
"The point is, to make so much money, that money isn't the point anymore."

Pro Version 4.0.19
Gold Version 4.1.3
Linux
Reply With Quote
  #174  
Old 06-30-2007, 10:35 PM
 
lapidarist lapidarist is offline
 

Advanced Member
  
Join Date: Apr 2003
Location: Hot Springs, Arkansas
Posts: 34
 

Default Re: Newest Products

Quote:
Originally Posted by JWait
That would be nice but I don't think there is a working code for the 4.1.x version. It is the major reason we have not upgraded.


I rewrote the newproducts module for 4.1.x

I am attaching a zip file for the code I use. It may have some bugs.. so we can work them out together

- james -
Attached Files
File Type: zip newproducts.zip (4.6 KB, 143 views)
__________________
X-Cart Gold Plus 4.5.4
X-PDF 4.5.3
X-Payments 1.05
CDSEO Pro 1.8.7
WebsiteCM Product Map 2.0.1
WebsiteCM Next-Prev 1.3 disabled because of SQL errors and bugs.
Reply With Quote
  #175  
Old 07-02-2007, 04:11 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,470
 

Default Re: Newest Products

Hello ...

Works great in 4.1.8

Just a few things to mention for the installation:

1) Comment out line 15 in newproducts.php if you're not using WebsiteCM's CDSEO Mod.
Quote:
include $xcart_dir."/modules/cdseolinks/cdseo_cat.php";
2) The language.sql has a slight error with the last INSERT (nothing major)
Replace line with this:
Quote:
INSERT INTO xcart_languages (code, name,value,topic) VALUES ('US','txt_no_newproducts','No new products have been listed within timeframe you specified','Text');
3) The default view is set to 7 days, this can be changed on line 42 of newproducts.php
Quote:
if (!$days || $days == 0) {$days = 7;}

Regards

Shafiq :sK
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #176  
Old 07-04-2007, 07:04 PM
 
yages yages is offline
 

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

Default Re: Newest Products

How do I get this to show in Categories. I add this to the categories.tpl
I am using this code
Only the word New Products show with no link

{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $main eq "newproducts"}New Products<HR size="1" noshade class="CateMenuHr">
{else}
New Products<HR size="1" noshade class="CateMenuHr">
{/if}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #177  
Old 07-06-2007, 09:25 AM
 
LisaB LisaB is offline
 

Advanced Member
  
Join Date: Jan 2007
Posts: 74
 

Default Re: Newest Products

Hi! Had a problem with this mod for version 4.1.x as listed above by lapidarist. I used the zip file and made the modifications recommended by chamberinternet.

When you arrive at the link, the following error occurs when a time frame is chosen with no new products,

Warning
: array_slice() [function.array-slice]: The first argument should be an array in /home/wwwjust/public_html/shop/newproducts.php on line 153

Line 153 reads: $newproducts = array_slice($temp_products, $lowerLimit, ($upperLimit - $lowerLimit));
__________________
XCart Version 4.1.6
PHP 4.4.4
MySQL 4.1.21-standard
Reply With Quote
  #178  
Old 07-07-2007, 08:16 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
How do I get this to show in Categories. I add this to the categories.tpl
I am using this code
Only the word New Products show with no link

{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $main eq "newproducts"}New Products<HR size="1" noshade class="CateMenuHr">
{else}
New Products<HR size="1" noshade class="CateMenuHr">
{/if}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}

It could be because you have not specified a link to newproducts.php. Since it is "newproducts" is not a category it will not be there on its own, you need to add a link to it.
Try....

{if $main eq "newproducts"}<a href="newproducts.php">New Products<HR size="1" noshade class="CateMenuHr"></a>
{else}
<a href="newproducts.php">New Products<HR size="1" noshade class="CateMenuHr"></a>
{/if}
__________________
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
  #179  
Old 07-07-2007, 08:34 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 LisaB

When you arrive at the link, the following error occurs when a time frame is chosen with no new products,

Warning
: array_slice() [function.array-slice]: The first argument should be an array in /home/wwwjust/public_html/shop/newproducts.php on line 153

Line 153 reads: $newproducts = array_slice($temp_products, $lowerLimit, ($upperLimit - $lowerLimit));

Yes, this seems to be a problem when there is no new products in the specified time period. The rest seems to be working ok. From the error message, it appears that there should be an array and none is created if the array is empty (no new products). I tried changing the area around line 147 so it says...

# if we have items to show.. go get them.. if not it will default to empty string "".
if ($total_items > 0) {
# get the product list that is limited to the page we need to display.
print_debug("temp_products count: " . count($temp_products) . "<br />");
print_debug("lowerLimit: $lowerLimit upperLimit: $upperLimit <br>");
}
if ($temp_products > 0) {
$newproducts = array_slice($temp_products, $lowerLimit, ($upperLimit - $lowerLimit));
print_debug("newproducts count: " . count($newproducts) . "<br />");
}

I added a check that $temp_products > 0.
and it seems to work. Try it and see what you get.
__________________
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
  #180  
Old 07-07-2007, 10:59 AM
 
lapidarist lapidarist is offline
 

Advanced Member
  
Join Date: Apr 2003
Location: Hot Springs, Arkansas
Posts: 34
 

Default Re: Newest Products

Quote:
Originally Posted by LisaB
Hi! Had a problem with this mod for version 4.1.x as listed above by lapidarist. I used the zip file and made the modifications recommended by chamberinternet.

When you arrive at the link, the following error occurs when a time frame is chosen with no new products,

Warning
: array_slice() [function.array-slice]: The first argument should be an array in /home/wwwjust/public_html/shop/newproducts.php on line 153

Line 153 reads: $newproducts = array_slice($temp_products, $lowerLimit, ($upperLimit - $lowerLimit));


I modified the code to:

1. Conditionally load WebsiteCM CDSEO if it exists (thanks chamberinternet) .
2. Updated the bad SQL statement in the language file (thanks chamberinternet).
3. Added a $default_days variable to set default instead of 7 days (thanks chamberinternet)
4. Fixed the bug to check if an array is returned from the search.. if not it will create
an empty array (thanks LisaB)
5. Updated the install file
6. Changed code to not show new products that are not available (sold). This was
confusing my customers.


Hopefully this will fix some problems.
Attached Files
File Type: zip newproducts.zip (4.7 KB, 147 views)
__________________
X-Cart Gold Plus 4.5.4
X-PDF 4.5.3
X-Payments 1.05
CDSEO Pro 1.8.7
WebsiteCM Product Map 2.0.1
WebsiteCM Next-Prev 1.3 disabled because of SQL errors and bugs.
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 01:49 PM.

   

 
X-Cart forums © 2001-2020