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)

carlisleglass 11-18-2003 04:30 AM

Works on the latest version of X-Cart. Took me a while to work out that the first couple of steps are not done on the templates but within the main x-cart directory.

tjeerd 01-09-2004 02:44 AM

no thumbnails in 3.5.2
 
What worked fine in older versions, didn't in version 3.5.2
I'm getting the "no image available" message. In phpMyAdmin, I saw the links are without any backslashes. The product.php page and customer/products.php, show the thumbs just fine.

Jason Brice 03-11-2004 01:11 AM

Will this work with 3.5.4?
 
Hi,

My we get new items in every week (comics) and we'd just like a simple list of them all, in three columns perhaps, on the front page.

Will the mod as it stands accomodate this under 3.5.4?

domspe 03-24-2004 06:03 AM

Quote:

What worked fine in older versions, didn't in version 3.5.2

I'm assuming with this comment, that this mod will not work in 3.5.X

is anyone familiar with the new beast enough to know what would need to be modded to make this oh-so-cool modification work in 3.5.X? :D

Jason Brice 03-24-2004 11:42 AM

I got it working in 3.5.4 using the instructions provided at the top of this thread and a little tweaking. A lot easier than I excpected!

Emerson 04-02-2004 03:33 PM

has anyone gotten this to work on 3.5.5?

Also, is there a way to set it so the last 6 products added are shown regardless of time?

Thanks ;)

Emerson 04-03-2004 08:56 AM

To those of you that want to know, I had this working fine on a 3.5.5 Pro and now I upgraded to 3.5.6 and it also works fine.

;)

ShopinHK 04-22-2004 07:40 AM

Quick question.

How can I disable the buy now button on here? A fair number of my products need optional config (measurements etc) and the mod does not list them. Would rather have them go to the product page and then choose the option from there.

Using 3.5.6 pro.

ShopinHK 04-23-2004 10:13 PM

Hi, Any suggestions? Unfortunately, I'm too new to Smarty and the way in which x-cart works to figure this one out.

timbermanr 06-26-2004 04:45 PM

Can this just show Items with Images?
 
I try to modify the query but I'm not much of an SQL guy..
Wanted to know if there was an easy way to just limit the query to just products with actual thumbnails OTHER than the default??

Thanks!

jin 07-09-2004 10:27 PM

Hi. I have simple question.
If I want to display products which were newly added in last few weeks in other page(not in home), how should I use this code provided at the beginning of the thread? I also want to have link to the page in menu at left column.

------------------
v.3.5.9 Linux

exhibit-x 07-22-2004 01:57 PM

if anyone would like to make it column based...

amend newest.tpl...

from...
Code:

{include file="customer/main/products.tpl" products=$newproducts}

to...
Code:

{include file="customer/main/products.tpl" products=$newproducts featured="Y"}

warrenkong@earthlink.net 08-09-2004 04:23 PM

I have wholesale pricing for our products and this search query is picking those up. So now it shows my new product twice, once at the retail price and again at the wholesale price. Does anyone know how to write the search query to show the price based on the membership?

Thanks

donavichi 08-10-2004 01:14 AM

Awesome!

Thanks fellas

donavichi 08-11-2004 06:12 AM

I hit upon a problem since installing this mod yesterday.

The image thumbnails do not display..?!

I am using 3.5.7 and storing my images in FS not DB and the thumbnail images are fine in products' categories....

august 09-20-2004 10:46 PM

Had anybody try this mod in 4.0.x?

Emerson 09-23-2004 06:01 AM

Quote:

Originally Posted by august
Had anybody try this mod in 4.0.x?


I'm gonna try it tonight and let you know ;)

august 09-23-2004 07:59 AM

Thanks in advanced!!!

Emerson 09-23-2004 08:06 AM

Hi There,
I have been able to get it to work with the following:

The newest.php file should be created in the xcart root directory, not in the customer directory.
Also, edit the xcart/home.php file instead of /xcart/customer/home.php and add
Code:

require "newest.php";
instead of
Code:

require "./newest.php";


The mod works fine in 4.x if you make the modifications I mentioned above ;)

BHMedia 09-29-2004 07:28 PM

Hey running 4.0.3 - everything is working perfect except it is saying Enter your price! Heh... HELP!

BHMedia 09-29-2004 07:50 PM

you know what would make this a killer mod - we have a site that ads over 500 products a week - so this mod would just pull out X amount - to eaither make it have it so it can have XXXXX Products but if it is over 10 on a page it will show the 1 2 3 4 5 6 on top or just have like RANDOM newest products... how would i do that?

BHMedia 09-29-2004 08:05 PM

Im not sure if this part is even worth posting but I figured it out..

I wanted to make it so it will just RANDOM the 6 products i had there... Because my client has so many updated products...

here goes

all you have to do is change the query from


Code:

$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY xcart_products.productID DESC LIMIT 0,5 ";

to

Code:

// the database query
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY RAND() LIMIT 6 ";



Hope this helps... This works for 4.03...

mizzlewillz 09-30-2004 09:28 AM

This is a nice mod. After playing around with the settings I was able to limit the choices to a certain category, but is there a way to make it so there are more than one page similar to the products.tpl. We will be adding lots of products each week and would like to list them 10 to 15 items to a page rather than all the new products at once. I thought X-cart would break them into pages but it doesn't.

Also, when working with this mod in 4.0.4 instead of a price it says "enter a price!" I know someone besides me has had this problem, but did anyone find a solution to that.

Any comments is appreciated.

-Mike

BHMedia 09-30-2004 07:15 PM

I just cleared out the label so it reads nothing... I cant figure it out tho...

finestshops 10-01-2004 05:22 PM

Quote:

Originally Posted by mizzlewillz
Also, when working with this mod in 4.0.4 instead of a price it says "enter a price!" I know someone besides me has had this problem, but did anyone find a solution to that.
-Mike


Hi there,

Here is modified newest.php which works in 4.0.4 and shows the price and loads images from server, not via image.php

Code:

<?
#
# $Id: newest.php by FS (based on featured_products.php and newest.php by funkydunk), v 1.2.2.3m 2004/10/01 Exp $

// set variables
$daterange = 604800; // 60 * 60 * 24 * 7 days in unix time
$nowtime = time();
$oldtime = $nowtime - $daterange ;

#
# Get newest products data and store it into $newproducts array
#

if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }

#
# select from products table
#

$membership = !empty($user_account['membership'])?$user_account['membership']:"";
$f_cat = (empty ($cat) ? "0" : $cat);
if ($config["General"]["unlimited_products"]=="N" && $config["General"]["disable_outofstock_products"])
        $avail_condition = "($sql_tbl[products].avail>0 OR $sql_tbl[products].product_type='C') and ";
else
        $avail_condition = "";
// $newproducts = func_query("SELECT $sql_tbl[products].*, min($sql_tbl[pricing].price) as price FROM $sql_tbl[products], $sql_tbl[products] USE INDEX (pacpo), $sql_tbl[pricing] WHERE $sql_tbl[products].productid=$sql_tbl[featured_products].productid and $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].forsale='Y' and $avail_condition $sql_tbl[featured_products].avail='Y' and $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND $sql_tbl[featured_products].categoryid='$f_cat' and ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[featured_products].product_order");
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY xcart_products.productID DESC LIMIT 0,6 ";
$newproducts = func_query($query);

if(is_array($newproducts)){
    foreach($newproducts as $f_v => $f_k){
        $int_res = '';
        if(is_array($f_k)){
                        if(!empty($active_modules['Product_Options'])) {
                                $tmp_price = func_get_price_default_variant($newproducts[$f_v]['productid'], @$user_account['membership']);
                                if ($tmp_price)
                                        $newproducts[$f_v]["price"] = $tmp_price;
                        }

#
# Get thumbnail's URL (uses only if images stored in FS)

                        $newproducts[$f_v]["tmbn_url"] = func_get_thumbnail_url($newproducts[$f_v]["productid"]);
#
# Recalculate prices if VAT is enabled and prices do not includes VAT
#
                        $newproducts[$f_v]["taxes"] = func_get_product_taxes($newproducts[$f_v], $login);

#
# Check if product have product options
#
                        if(!empty($active_modules['Product_Options'])) {
                                $newproducts[$f_v]["product_options"] = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[classes] WHERE productid='".$f_k["productid"]."'");
                        }

#
# Replace descr and fulldescr on international (if defined)
#
            $int_res = func_query_first("SELECT * FROM  $sql_tbl[products_lng] WHERE code='$store_language' AND productid='".$f_k['productid']."'");
                        if (!empty($int_res["product"])) {
                                $newproducts[$f_v]["product"] = stripslashes($int_res["product"]);
                    }   
                if (!empty($int_res["descr"])) {
                            $newproducts[$f_v]["descr"] = str_replace("\n","
", stripslashes($int_res["descr"]));
                    }   
                    if (!empty($int_res["full_descr"])) {
                        $newproducts[$f_v]["fulldescr"] = str_replace("\n","
", stripslashes($int_res["full_descr"]));
                    }

                        if ($newproducts[$f_v]["descr"] == strip_tags($newproducts[$f_v]["descr"]))
                                $newproducts[$f_v]["descr"] = str_replace("\n", "
", $newproducts[$f_v]["descr"]);

                        if ($newproducts[$f_v]["fulldescr"] == strip_tags($newproducts[$f_v]["fulldescr"]))
                                $newproducts[$f_v]["fulldescr"] = str_replace("\n", "
", $newproducts[$f_v]["fulldescr"]);

                }       
        }
}; 


if (!empty($active_modules["Subscriptions"])) {
    include_once $xcart_dir."/modules/Subscriptions/subscription.php";
}
       
$smarty->assign("newproducts",$newproducts);

// give the product array to smarty to make it available sitewide.
$smarty->assign("newproducts",$newproducts);


?>


Example is here:

http://www.shopping-carts-upgrades.com/store/

:D

Enjoy,

hobbyhandig 10-22-2004 01:49 AM

Using 4.0.5, newest.php gives an parse error on line 23

http://hobbyhandig.webfontein.nl

What did I do wrong?

hobbyhandig 11-01-2004 02:01 AM

Anyone? I really want this mod, but it doesn't work! :roll:

B00MER 11-01-2004 05:40 AM

:arrow: http://www.cart-lab.com/Newest_Products-p-53.html Easier to use and setup :D

hobbyhandig 11-01-2004 06:00 AM

Hi Boomer,

If it were my money I would buy it! :D

But my boss has to pay, so I would really like if I can get the free version to work for me, like all these people in this topic before me! :wink:

StitchClix 11-17-2004 12:40 PM

OK, I hate to be a newbie. I've gotten this to work on the home page, but how do you make an independent page displaying only the new items. I've read this whole section several times, and maybe I just don't know what I'm looking for, but I can't figure it out. Any help would be hugely appreciated.

Mike
StitchClix.com

finestshops 11-17-2004 02:05 PM

Try this:

add in customer/home_main.tpl

Code:

{elseif $main eq "newest"}
{include file="customer/main/newest.tpl"}


in newest.php

at the beginning add

Code:

require "./auth.php";

and at the end:

Code:

$smarty->assign("main","newest");
$smarty->display("customer/home.tpl");


do not forget to remove

Code:

require "./newest.php";

from home.php

now try to run http://www.domain.com/store/newest.php
Should work if I did not miss something :wink:

Or just order this mod here:
http://www.shopping-carts-upgrades.com/Newest-Products-Added-p-91.html

and we'll set it up this way.

josu 11-22-2004 05:29 AM

Not working newest.php
 
I have created the newest.php and do the modifications indicated, but I can not see the new products...

earion 11-28-2004 10:40 AM

i've tried to lok for a solution to this problem on my own but i'm not a sql guy... i need in my first page a newest products modules except it has to be on 3 columns and each column is a different category.
I think i know how it would work : each column is displayed like in the store and using the add_date we can narrow it down to say 5 or 10 products ordered by add_date. Can you guys help me out ?
Thanks in advance !

rapsearch 12-20-2004 11:24 AM

I would be very interested in the ^ as well... Can anyone help out with this for the x-cart generation 4?

(wonderes why this is not default in x-cart....)

pcdoktorn 12-24-2004 02:11 PM

Seems this mod is not working in 4.0.8
I get an error saying
Parse error: parse error, unexpected T_USE in /home/www/www/pcdoktorn/newest.php on line 27

eaglemobiles 01-10-2005 07:31 PM

is it working in 4.0.9

Thanks

shishapipe 01-12-2005 06:53 AM

Cant get it to work on x-cart 4.09 :(

This works ok http://www.shisha.co.uk/shopcart/newest.php
but when i use http://www.shisha.co.uk/shopcart/home.php

I get the NEW blue bar at the bottom but no products :(

Any ideas, i have followed the postings, but cant find the problem.

I Know that the code for x-cart 4.09 in shopcart/skin1/customer/main/welcome.tpl is working fine

Code:

{* $Id: welcome.tpl,v 1.23 2004/05/28 12:21:00 max Exp $ *}
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD height="19" class="WelcomeTitle" background="{$ImagesDir}/custom/welcome_title_bottom_bg.gif" valign="top">
{if ($active_modules.Greet_Visitor ne "") AND ($smarty.cookies.GreetingCookie ne "")}
{$lng.lbl_welcome_back}, {$smarty.cookies.GreetingCookie|replace:"\'":"'"}
{else}
{$lng.lbl_welcome_to} { $config.Company.company_name }
{/if}
</TD>
</TR>
<TR>
<TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR><TD class="WelcomeBox" background="{$ImagesDir}/custom/welcome_bg.gif"><TABLE border="0" cellpadding="5" cellspacing="10">
<TR>
<TD valign="top">[img]{$ImagesDir}/custom/welcome_image.gif[/img]</TD>
<TD class="WelcomeBox">{$lng.txt_welcome}
</TD></TR>
</TABLE></TD></TR>
</TABLE>

{*capture name=dialog}
{$lng.txt_welcome}
{/capture}
{if ($active_modules.Greet_Visitor ne "") AND ($smarty.cookies.GreetingCookie ne "")}
{include file="dialog.tpl" title="`$lng.lbl_welcome_back`, `$smarty.cookies.GreetingCookie`" content=$smarty.capture.dialog extra="width=100%" dialog_box_color="_orange"}
{else}
{include file="dialog.tpl" title="`$lng.lbl_welcome_to` `$config.Company.company_name`" content=$smarty.capture.dialog extra="width=100%" dialog_box_color="_orange"}
{/if*}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"}
{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}
{include file="customer/main/featured.tpl" f_products=$f_products dialog_title_color="_orange"}


 
{include file="customer/main/newest.tpl" newproducts=$newproducts dialog_title_color="_orange"}


I know that the shopcart/newest.php works fine.

So all i need to check now is the:
shopcart/home.php modification
shopcart/skin1/customer/home_main.tpl modification
shopcart/skin1/customer/main/newest.tpl modification

shishapipe 01-12-2005 08:05 AM

Also checked the shopcart/skin1/customer/home_main.tpl (x-cart 4.09)

And that is OK

Code:

{if $smarty.get.mode eq "subscribed"}
{include file="main/subscribe_confirmation.tpl"}

{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}

{elseif $main eq "returns"}
{include file="modules/RMA/returns.tpl"}

{elseif $main eq "register"}
{include file="customer/main/register.tpl"}

{elseif $main eq "download"}
{include file="modules/Egoods/main.tpl"}

{elseif $main eq "send_to_friend"}
{include file="customer/main/send_to_friend.tpl"}

{elseif $main eq "pages"}
{include file="customer/main/pages.tpl"}

{elseif $main eq "manufacturers_list"}
{include file="modules/Manufacturers/customer_manufacturers_list.tpl"}

{elseif $main eq "manufacturer_products"}
{include file="modules/Manufacturers/customer_manufacturer_products.tpl"}

{elseif $main eq "search"}
{include file="customer/main/search_result.tpl"}

{elseif $main eq "advanced_search"}
{include file="customer/main/search_result.tpl"}

{elseif $main eq "cart"}
{include file="customer/main/cart.tpl"}

{elseif $main eq "comparison" && $active_modules.Feature_Comparison ne ''}
{include file="modules/Feature_Comparison/comparison.tpl"}

{elseif $main eq "choosing" && $active_modules.Feature_Comparison ne ''}
{include file="modules/Feature_Comparison/choosing.tpl"}

{elseif $main eq "wishlist"}
{if $active_modules.Wishlist ne ""}
{include file="modules/Wishlist/wishlist.tpl"}
{/if}

{elseif $main eq "anonymous_checkout"}
{include file="customer/main/anonymous_checkout.tpl"}

{elseif $main eq "order_message"}
{include file="customer/main/order_message.tpl"}

{elseif $main eq "checkout"}
{include file="customer/main/checkout.tpl"}

{elseif $main eq "product"}
{include file="customer/main/product.tpl" product=$product}

{elseif $main eq "giftcert"}
{include file="modules/Gift_Certificates/giftcert.tpl"}

{elseif $main eq "subscriptions"}
{include file="modules/Subscriptions/subscriptions.tpl"}

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

{elseif $main eq "catalog"}
{include file="customer/main/subcategories.tpl" cat=$cat}

{elseif $active_modules.Gift_Registry ne "" and $main eq "giftreg"}
{include file="modules/Gift_Registry/giftreg_common.tpl"}

{elseif $main eq "product_configurator"}
{include file="modules/Product_Configurator/pconf_common.tpl"}

{elseif $main eq "secure_login_form"}
{include file="customer/main/secure_login_form.tpl"}

{elseif $main eq "news_archive"}
{include file="modules/News_Management/news_archive.tpl"}

{elseif $main eq "change_password"}
{include file="customer/main/change_password.tpl"}

{elseif $main eq "customer_offers"}
{include file="modules/Special_Offers/customer/offers.tpl"}

{elseif $main eq "customer_bonuses"}
{include file="modules/Special_Offers/customer/bonuses.tpl"}

{elseif $main eq "newest"}
{include file="customer/main/newest.tpl"}

{else}
{include file="common_templates.tpl"}
{include file="customer/main/welcome.tpl" f_products=$f_products newproducts=$newproducts}

{/if}


shishapipe 01-12-2005 08:10 AM

Also checked shopcart/skin1/customer/main/newest.tpl (x-cart 4.09)

And this is ok, so its got to be something in the shopcart/home.php file

Code:

{* $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 featured="Y"}
{else}
{$lng.txt_no_new}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_new_products content=$smarty.capture.dialog extra="width=100%"}


roccons 01-14-2005 01:17 PM

First of all
thanks for the great mod!
I installed it yesterday and runs pretty well both as a welcome page and as a newest.php linkeable page.
I'm interested in being able to show the result of newest products in several pages.
I know I need to do something related with the products_per_page variable but don't know how or where.
Here is my newest.tpl code:
Code:

{* $Id: newest.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *}
{*sцЁlo si el template es llamado desde newest_display.php muestra la barra location*}
{if $main eq "newest"}
{include file="location.tpl" last_location=$lng.lbl_new_products}
{/if}
{capture name=dialog}
{if $newproducts ne ""}
{include file="customer/main/products.tpl" products=$newproducts}
{else}
{$lng.txt_no_new}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_new_products content=$smarty.capture.dialog extra="width=100%"}

And here is my newest_display.php code:
Code:

<?
//para que pueda presentarse sola
require "./auth.php";
require $xcart_dir."/include/categories.php";
if (!empty($cat))
        require "./products.php";
// set variables
$daterange = 9000000; // (60*60*24=86400)*(nц╨mero de dц╜as) ej. 7 dц╜as = 86400*7 = 604800 unix time
$nowtime = time();
$oldtime = $nowtime - $daterange ;

// the database query
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY xcart_products.productID DESC LIMIT 0,12 ";
// change the LIMIT 0,x above to indicate max number of items

// give the product array to smarty to make it available sitewide.
$newproducts = func_query($query);
$smarty->assign("newproducts",$newproducts);
//para que pueda presentarse sola
$smarty->assign("main","newest");
$smarty->display("customer/home.tpl");
?>

Any ideas?
Thanks in advance.


All times are GMT -8. The time now is 10:22 AM.

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