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 |
Quote:
Thanks alkhashrami The above line of code that you provided solved my problem in getting this mod to work. [/quote] |
Well, something is definitely not right, this won't work in 4.0.13, and I don't see it working in your sites either.
|
**Update** Already got it as I wanted
I'm willing to pay for a "What's New" MOD, that have the same principle as Funky MOD (http://forum.x-cart.com/viewtopic.php?t=1418&postdays=0&postorder=asc&high light=newest%20mod&start=0), with this requirements: 1- Must work in version 4.0.13 2- Need to open in a new window from special.tpl 3- Must do random product. 4- Have a selection of how many days you want to see the new products. (10, 30, 60) 5- Must be open source 6- Be reasonable with the price All the code is there in the forum it just need to make it work in the actual version, Duncan did it once for me in version 3.4.0, but now he does not want to work with x-cart products. I still have the backup that he gave me. |
alkhashrami,
Your mod worked excellent in 4.0.13 All I did was follow your instructions. *smile* thanks. - Shannon |
Thank you IndieDepot,
this is what i hope and don't foreget that the original code was posted by walteis i hope the users of x-cart will find this mod useful as i do. |
Hi, just curious, whe do we have 2 instances off {include file="customer/main/navigation.tpl"}
Code:
{include file="customer/main/navigation.tpl"} |
How can i get this mod running on 3.5.14?
|
Quote:
|
Re: What's new mod
Quote:
My question is this...I've done everything else from your original post...cept this. Not sure where or how to do t his? I have a new products box showing up on my homepage....but nothing is in it. Is this what I need to do for product to show up??? And if so...how? Thank you in advance... Janel |
Re: What's new mod
Quote:
i have almost the same problem as you i did everything but the config table bit as i wasnt sure what to do there only difference is i dont seem to have any box showing on my home page its almost as if i had never added the mod at all anyone help me??? |
Re: What's new mod
1 Attachment(s)
Thanks for the mod, seems to work fine in v4.x.
16/1/08 - UPDATED TO FIX SECURITY RISK |
Re: What's new mod
Hi!
I am using X-Cart Pro 4.1.5 and am looking to install this modification .. I'm at this point: 3) In /skin1/customer/home_main.tpl Add the following... {elseif $wn ne ""} {include file="customer/newest.tpl"} Instead of adding it to my home_main.tpl, I'd like to add a link in my categories menu. Does anyone have any newbie advice on how to do this? I found my categories.tpl but I am not sure what to add (the above code?) and where to add it in the code. Thanks in advance for any help with this :) |
Re: What's new mod
I don't think this mod works with version 4.1.x. It works fine with version 4.0.x though.
Anyway, the newest.tpl refers to the output page I believe. You need to call newproduct.php (or whatever its called) from a link. |
Re: What's new mod
Thanks for this mod. I've got it working, but somehow loading the page(s) with the newest products takes ages... :?
Anybody got a idea what could be causing this? Thanks! |
Re: What's new mod
Does this Mod work with 4.1.3 ????
When I install this - It returns all the products. |
Re: What's new mod
The same here . whatever # you set it on , still returns all the products !!!
philj maybe able to answer this !!! |
Re: What's new mod
I have exact same problem. It does not matter what you put for wn. It shows just all products.
for example my store has totaly 25 products. wn=1 or wn=7 all 25 products appears then. I did not get it. Any help? |
Re: What's new mod
Is there any chance that this mod will be updated to work with 4.1.7?
|
Re: What's new mod
This mod works great, except...
Example: I want to see the items added in the last 14 days. Site is set to show 12 items per page. ** I have 15 new items. ** I call the script, and it shows the first 12 items. ** I click on the page 2 button, but instead of the remaining 3 items, I get most or all the items on the site. I can see that when I hover over the page 2 button, it is going to go to: www.domain.com/search.php?mode=search&page=2 Wheras the first page is on: www.domain.com/newest.php?wn=14 Ideas, anyone? - Ken |
Re: What's new mod
See the thread at http://forum.x-cart.com/showthread.php?t=1084 for a working version similar to this mod (I think its better) for 4.0.x and later in the thread (around page 19) a working version for 4.1.x
|
Re: What's new mod
If you are using the first version on this page, you need to add this code into your newest.php at the very top or you are vulnerable to being hacked:
Code:
<?php If you are using the version posted by PhilJ then find: Code:
require "./auth.php"; After put: Code:
(int)$wn; |
All times are GMT -8. The time now is 05:11 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.