X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Newest Products (https://forum.x-cart.com/showthread.php?t=1084)

Lingerieblowout 11-12-2007 05:39 PM

Re: Newest Products
 
The Newest Items is a custom mod and the shop by price features already exist under Advance Search. Im sure you can enhance the search by price. Can you send me a PM of your URL.

scoobie 11-17-2007 08:57 PM

Re: Newest Products
 
Hi,

This post seems so simple but I just can't get it right. I don't want the new products to be called from a link in the lhs (i.e. VertMenuLeftColumn). I would like the new products to display in the main content area.

I thought if I add the following include to my home.php that everything would be sweet:-
include "./newproducts.php";

This is a small chunk of my home.php file:-
// WCM - CDSEO Links
include $xcart_dir."/modules/cdseolinks/cdseo_cat.php";

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";

include "./newproducts.php";


if ($active_modules["Bestsellers"])
include $xcart_dir."/modules/Bestsellers/bestsellers.php";



My home_main.tpl looks like this at the bottom:-
{elseif $main eq "newproducts"}
{include file="customer/main/newproducts.tpl"}
{else}
{include file="common_templates.tpl"}
{/if}


What I get is a blank white page. I haven't changed any of the new files, so I must be doing something wrong. Can someone put me on the right path?

pig@pp 12-12-2007 02:20 PM

Re: Newest Products
 
I've installed this mod on v4.1.9 and it works fine except I can't get the Price: $XXX to display. Mod originally displayed "Enter Your Price" but I was able to find and remove the code for that. Any suggestions?

Thanks!

UPDATE: Fixed it. Borrowed some code from products_t.tpl

poil11 01-19-2008 06:24 PM

Re: Newest Products
 
Great Mod, just getting into x-cart. Anyway can make a Buy Now button next to each item?

babydollcosmetics 01-28-2008 06:47 AM

Re: Newest Products
 
Quote:

Originally Posted by lapidarist
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.


thanx so much.
however, when i add this on my website,
everything seems to work fine.
the new products do show on the newproducts.php page...
but they do not show on my home page.
it just keeps showing:

"Products added since:

No new products have been listed within timeframe you specified "

what did i do wrong? :?

erickim 02-28-2008 08:21 AM

Re: Newest Products
 
Quote:

Originally Posted by pavant
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.


I followed your(Pavant's) codes posted #186, it works fine except one thing.
It shows the products alphabetical order, not by newest.
I have 4.1.9 xcart. Could you help me what is wrong with this?
Or anybody help me?


Thank you.

ScrapProfessor 03-20-2008 04:32 PM

Re: Newest Products
 
I would love help on this also. I'm running x-cart pro 4.1.9.

Can someone help?

Thank you!

yamiya 04-16-2008 12:09 PM

Re: Newest Products
 
I like to modify the code such that I can display entire category in front page.

Anyone knows how to do it?

Quote:

Originally Posted by vulcan-works
PHP Code:

#
# $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); 



You must add:
Code:

<?php
at the very top of the file
and
Code:

?>
to the end of it for it to work
but other than that great job!


flawfulfibers 04-22-2008 10:08 AM

Re: Newest Products
 
I have John C's version running, but now I'm getting SQL errors 1064, where it looks like there may be a security issue through newproducts.php? Anyone know what I can add to fix it? I tried what was suggested for the other new products mods, but that didn't work.

ScrapProfessor 04-22-2008 11:00 AM

Re: Newest Products
 
I am getting the same MySQL error message. Can anyone help? It would be appreciated! ;)


All times are GMT -8. The time now is 01:45 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.