What's new mod
I've created a pretty simple "what's new" modification that someone might be interested in. It displays all the products that were created within a configurable number of days.
First, create a PHP file called newest.php that contains the following code: Code:
<? Then change home.php to include the following: Code:
if (!empty($wn)) { I put that right after the Bestsellers code. Next, you'll need a template called customer/main/newest.tpl Code:
Then edit customer/home_main.tpl to include the previous template: Code:
{elseif $main eq "subscriptions"} Then I added a config table setting called TFTACustom.wndays, you can call it anything you'd like. Assuming that you called it that, you can then add a link in the categories.tpl This mod works as written with 4.0.7 Walt |
I've seen something like this before and very handy it was BUT it's only downfall is if you create a new product and then set it to disabled (because you updating your store and want to enable it later) it will still show in your new product list.
Does yours suffer from that as well or does it obey the disabled rule?? |
$search_data["products"]["forsale"] = "Y";
it will only show if its available for sale. |
Quote:
Where do I configure the number of days? Thanks |
Quote:
at the top of the script Code:
<? |
Hi,
thanks for this mod I've tested your mod in 4.0.12 with fashion moasic skin every thing was good except it appears in the main page which is not good for that skin SO, how can i configure it to work like if we see a category i.e. not in the main page thanks again |
Quote:
if (!empty($wn)) { include "./newest.php"; $smarty->assign("wn","$wn"); } don't put above code in home.php instead put it in catagories.php |
i did what you said
Quote:
but after calling, it returns to home page without any results any other idea? |
Hi everybody :) ,
i tried to modify the this mod to work with my x-cart version and skin, inspite i'm not a php expert but i depend on comparing similar files and do needed changes then testing on the site. After 2 days i think that i solve it and this is the mod after modifications: First, create a PHP file called newest.php that contains the following code: Code:
<?php Next, you'll need a template called customer/main/newest.tpl that contains the following code: Code:
{capture name=dialog} Then edit customer/home_main.tpl to include this code: Code:
{elseif $wn ne ""} Then, add these lang variables to the database (SQL) Code:
INSERT INTO xcart_languages VALUES ('US','New products','lbl_new_products','New products','Labels'); Finally, you can call this mod through a link e.g: "wn" indicats the number of days , wn=10 i.e. 10 days I hope this will be good, and correct me if there is any mistake thanks for all of you. :) |
If i try this link:
http://www.indyplaza.com/catalog/newest.php?wn=10 I got: Page not found! The requested page does not exist or you are not allowed to access it! If i try this link: http://www.indyplaza.com/catalog/newest.php I got: INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') <= from_unixtime(add_date) AND xcart_pricing.productid=xcart_ SQL QUERY FAILURE: SELECT COUNT(xcart_products.productid), MIN(xcart_pricing.price) as price , xcart_products_lng.product as product_lng, xcart_products_lng.descr as descr_lng, xcart_products_lng.full_descr as fulldescr_lng, IF(xcart_variants.variantid IS NOT NULL,'Y','') as is_variant, IF(xcart_classes.classid IS NOT NULL,'Y','') as is_product_options, v_pricing.price as v_price FROM xcart_products, xcart_pricing , xcart_featured_products, xcart_products_categories, xcart_categories LEFT JOIN xcart_products_lng ON xcart_products_lng.productid = xcart_products.productid AND xcart_products_lng.code = 'US' LEFT JOIN xcart_classes ON xcart_classes.productid = xcart_products.productid LEFT JOIN xcart_variants ON xcart_variants.productid = xcart_products.productid LEFT JOIN xcart_pricing as v_pricing ON v_pricing.variantid = xcart_variants.variantid AND v_pricing.quantity = 1 AND v_pricing.membership IN ('','') WHERE DATE_SUB(CURDATE(),INTERVAL DAY) <= from_unixtime(add_date) AND xcart_pricing.productid=xcart_products.productid AND xcart_pricing.quantity=1 AND xcart_pricing.membership IN ('','') AND (xcart_pricing.variantid = 0 OR (xcart_variants.variantid = xcart_pricing.variantid)) AND xcart_products_categories.productid=xcart_products .productid AND xcart_products_categories.categoryid = xcart_categories.categoryid AND xcart_categories.membership IN ('','') AND xcart_products.forsale='Y' GROUP BY xcart_products.productid Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/indypla/public_html/catalog/include/func.php on line 102 |
All times are GMT -8. The time now is 09:12 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.