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)

tron 04-08-2005 02:20 AM

problem solved
 
I was having problems also. I am using 3.4.2.

I followed all the steps and had to redo it twice. not working.

then I found this:

http://forum.x-cart.com/viewtopic.php?t=1402&highlight=newest+tpl

I replaced the codes and now it's working.

2019 04-12-2005 02:31 PM

ShishaPipe i see that you make it work on 4.0.x
can you post codes here?
i couldn't make it work with my cart! :(

some1 pls?

IndieDepot 05-19-2005 09:32 PM

I would also like a "Newest Products" mod for 4.0.13.

Can anybody post the code?

- Shannon

gemanda 06-21-2005 09:47 AM

I've tried to get this to work...I have the Firetank newest products dialog, so that's not an issue. But I need to get a page of newest products, which that mod doesn't offer.

However, when I try everything in this thread, it looks all crazy. Any ideas on how to get the page to look like a normal product page?

Here's the craziness that it is now.

http://wholefamilymarket.com/shop/newest.php

craigbrass 06-26-2005 01:05 AM

How would I get it to show as a box like on http://www.itselixir.net/home.php as "Best Sellers" do?

Lucent88 09-13-2005 09:25 AM

anyone find out how to have to this work for v4.x yet?

WPOO 09-13-2005 12:32 PM

i would like too use this too
 
i would like too use this too

lapidarist 09-16-2005 12:41 PM

dd
 
Quote:

Originally Posted by gemanda
I've tried to get this to work...I have the Firetank newest products dialog, so that's not an issue. But I need to get a page of newest products, which that mod doesn't offer.

However, when I try everything in this thread, it looks all crazy. Any ideas on how to get the page to look like a normal product page?

Here's the craziness that it is now.

http://wholefamilymarket.com/shop/newest.php


I needed a way to show new products added. I wanted a page that had more information and gave some options. I have been working on one for my site. I am new to php and have only made a few small mods in xcart before.

My site is live, but you can see the new products page I have been working on. If this is something that looks interesting, I can clean it up some and post it.

http://www.unconventionallapidarist.com/xcart/newproducts.php

I am still looking for the code that sets the <site_name> :: <current> navigation link.

My cart is 4.0.15

- james -

MythNReality 09-21-2005 12:22 PM

Re: dd
 
Quote:

Originally Posted by lapidarist
I am still looking for the code that sets the <site_name> :: <current> navigation link.




James,

Your site looks great, that's the way I wanted to get done...would you please "share" the code and show us how, please~

lapidarist 09-23-2005 07:53 PM

New Products page
 
This is my first xcart add-on. I wrote some code to show New Products on its own page.

Crude install notes

1) You need to edit {xcart_dir}/skin1/customer/home_main.tpl

Add the following lines before the {else} at bottom of file:

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



2) Copy newproducts.tpl file to {$xcart_dir}/skin1/customer/main/

example: /xcart/skin1/customer/main/newproducts.tpl


3) Copy newproducts.php file to {xcart_dir}/

example: /xcart/newproducts.php


4) Apply the SQL Language file 'language.sql' into the Patch file section
of the X-cart Admin :: Patch/Upgrade center. Or load via mysql



5) You should now be able to put a link using

<domain_name>/{$xcart_dir}/newproducts.php


You can add the link anywhere (speed bar, href, help section, etc).


Let me know if this is useful to you :-)

James



Save this file as newproducts.php
Code:

<?
#+-----------------------------------------------------------------------------+
#| New Products add-on                                                        |
#| Copyright (c) 2005 James Carpenter <jamesc@unconventionallapidarist.com>    |
#| All rights reserved.                                                        |
#+-----------------------------------------------------------------------------+
#
# $Id: newproducts.php,v 1.0.0.1 2005/09/23 05:00:00 jfc Exp $
#

require "./auth.php";

require $xcart_dir."/include/categories.php";

# I am not sure what the membership should be set. On a generic
# Try to determine how to get this info from the current environment.
$membership = "";

# this could be set as a config option
if (!$days || $days == 0) {$days = 7;}

# default sorting if needed. This could be a config option.
if (!$sortby || $sortby == "") { $sortby = "add_date"; }


# This array is used to determine the from/to date range
# in the WHERE clause. It is also used for the labels
# for the range.
$newproducts_dayrange = array(
        1        =>        func_get_langvar_by_name("lbl_newproducts_24hrs"),
        3        =>        func_get_langvar_by_name("lbl_newproducts_3days"),
        7        =>        func_get_langvar_by_name("lbl_newproducts_7days"),
  30        =>        func_get_langvar_by_name("lbl_newproducts_30days")
);


# This array is used to determine the order by clause and labels
# used for sorting
$sort_fields = array(
        "add_date"                => func_get_langvar_by_name("lbl_newproducts_adddate"),
        "productcode"        => func_get_langvar_by_name("lbl_newproducts_sku"),
        "product"                => func_get_langvar_by_name("lbl_newproducts_product"),
    "price"                => func_get_langvar_by_name("lbl_newproducts_price")
);




# set date ranges
$date_range = 86400 * (integer)$days; // 60(sec) * 60(min) * 24(hrs) * $days in unix time
$now_time = time();
$from_time = $now_time - $date_range;

$query = "AND $sql_tbl[products].avail > 0 AND add_date > $from_time AND add_date < $now_time ";


# set the default
$newproducts = "";

# The function 'func_search_products' was taken from '{xcart_dir}/include/func.php'
# in version 4.0.16
# It was modified to give more product data back (descr,fulldescr, etc) and
# to be able to get the count that the query would return. 
#
function func_search_newproducts($query, $membership, $retcount, $orderby="", $limit="") {
        global $current_area, $user_account;
        global $store_language, $sql_tbl;
        global $config;
        global $cart, $login;
        global $active_modules;

        #
        # Generate ORDER BY rule
        #
        if (empty($orderby)) {
                $orderby = ($config["Appearance"]["products_order"] ? $config["Appearance"]["products_order"] : "orderby");
                if($orderby == 'title') {
                        $orderby = 'product';
                } elseif($orderby == 'quantity') {
                        $orderby = "$sql_tbl[products].avail";
                } elseif($orderby == "orderby") {
                        $orderby = "$sql_tbl[products_categories].orderby";
                } elseif($orderby == "quantity") {
                        $orderby = "$sql_tbl[products].avail";
                } elseif($orderby == "price") {
                        $orderby = "price";
                } elseif($orderby == "productcode") {
                        $orderby = "$sql_tbl[products].productcode";
                }
        }

       
        #
        # Generate membership condition
        #
        if ($current_area == "C") {
                $membership_condition = " AND ($sql_tbl[categories].membership='".addslashes($membership)."' OR $sql_tbl[categories].membership='') AND $sql_tbl[products].forsale='Y'";
        }
        else
                $membership_condition = "";

        #
        # Generate products availability condition
        #
        if ($config["General"]["unlimited_products"]=="N" && (($current_area == "C" || $current_area == "B") && $config["General"]["disable_outofstock_products"] == "Y"))
                $avail_condition = " AND $sql_tbl[products].avail>0 ";
        else
                $avail_condition = "";

        #$select_query = "SELECT $sql_tbl[products].productid, $sql_tbl[products].product, $sql_tbl[products].productcode, $sql_tbl[products].avail, MIN($sql_tbl[pricing].price) AS price";
        if ($retcount == 'Y') {
                $select_query = "SELECT COUNT($sql_tbl[products].productid)";
        }
        else {
                $select_query = "SELECT $sql_tbl[products].*, MIN($sql_tbl[pricing].price) AS price";
        }
       
        $from_query = " FROM $sql_tbl[products], $sql_tbl[categories], $sql_tbl[products_categories], $sql_tbl[pricing]";
       
        $where_query = " WHERE $sql_tbl[products].productid=$sql_tbl[products_categories].productid AND $sql_tbl[products_categories].categoryid=$sql_tbl[categories].categoryid AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND $sql_tbl[pricing].quantity=1 AND ($sql_tbl[pricing].membership='".addslashes($membership)."' OR $sql_tbl[pricing].membership='') $membership_condition $avail_condition";

        $where_query .= " AND $sql_tbl[pricing].variantid = 0";       

        if ($current_area == 'C' && empty($active_modules['Product_Configurator'])) {
                $where_query .= " AND $sql_tbl[products].product_type <> 'C' AND $sql_tbl[products].product_type <> 'B' ";
        }

        $groupby_query = " GROUP BY $sql_tbl[products].productid";
       
        $orderby_query = " ORDER BY $orderby";
       
        if (!empty($limit))
                $limit_query = " LIMIT $limit";

        if ($retcount == 'Y') {
                $search_query = $select_query.$from_query.$where_query.$query.$groupby_query;
                # print "QUERY: $search_query\n\n";
                $result = db_query($search_query);
                $total_items = db_num_rows($result);
                # print "Total Items: $total_items\n";
                db_free_result($result);
                $result = $total_items;
        }
        else
        {
                #
                # Check if product have prodyct class (Feature comparison)
                #
                if(!empty($active_modules['Feature_Comparison']) && $current_area == "C") {
                        global $comparison_list_ids;
                        $from_query .= " LEFT JOIN $sql_tbl[product_features] ON $sql_tbl[product_features].productid = $sql_tbl[products].productid";
                        $select_query .= ", $sql_tbl[product_features].fclassid";
                        if(($config['Feature_Comparison']['fcomparison_show_product_list'] == 'Y') && $config['Feature_Comparison']['fcomparison_max_product_list'] > @count((array)$comparison_list_ids)) {
                                $select_query .= ", IF($sql_tbl[product_features].fclassid IS NULL || $sql_tbl[product_features].productid IN ('".@implode("','",@array_keys((array)$comparison_list_ids))."'),'','Y') as is_clist";
                        }
                }

                #
                # Check if product have product options (Product options)
                #
                if(!empty($active_modules['Product_Options'])) {
                        $from_query .= " LEFT JOIN $sql_tbl[classes] ON $sql_tbl[classes].productid = $sql_tbl[products].productid LEFT JOIN $sql_tbl[variants] ON $sql_tbl[variants].productid = $sql_tbl[products].productid";
                        if ($current_area == 'C' && $config["General"]["disable_outofstock_products"] == "Y" && $config["General"]["unlimited_products"] != "Y") {
                                $from_query .= " AND $sql_tbl[variants].avail > 0";
                        }
                        $select_query .= ", SUM(IF($sql_tbl[classes].classid IS NULL,0,1)) as product_options, IF ($sql_tbl[classes].classid IS NULL,'','Y') as is_product_options, IF($sql_tbl[variants].variantid IS NULL,'','Y') as is_variant";
                }
               
                if ($current_area == "C" && $store_language != $config["default_customer_language"])
                        $from_query .= " LEFT JOIN $sql_tbl[products_lng] ON $sql_tbl[products].productid=$sql_tbl[products_lng].productid";

                #
                # Generate search query
                #
                $search_query = $select_query.$from_query.$where_query.$query.$groupby_query.$orderby_query.$limit_query;
               
                $result = func_query($search_query);       

                if ($result && ($current_area=="C" || $current_area=="B") ) {
                #
                # Post-process the result products array
                #
                        foreach ($result as $key=>$value) {
                                if (!empty($cart) and !empty($cart["products"]) && $current_area=="C") {
                                #
                                # Update quantity for products that already placed into the cart
                                #
                                        $in_cart = 0;
                                        foreach ($cart["products"] as $cart_item)
                                        if ($cart_item["productid"] == $value["productid"])
                                                $in_cart += $cart_item["amount"];
                                        $result[$key]["avail"] -= $in_cart;
                                }
               
                                #
                                # Get thumbnail's URL (uses only if images stored in FS)
                                # 
                                $result[$key]["tmbn_url"] = func_get_thumbnail_url($result[$key]["productid"]);
                               
                                if ($current_area == "C") {
                                        $result[$key]["taxes"] = func_get_product_taxes($result[$key], $login);
                                }

                                #
                                # Check if product have product options
                                #

                                $int_res = func_query_first("SELECT * FROM $sql_tbl[products_lng] WHERE code='$store_language' AND productid='$value[productid]'");
                               
                                if (!empty($int_res["product"]))
                                        $result[$key]["product"] = stripslashes($int_res["product"]);
                               
                                if (!empty($int_res["descr"]))
                                        $result[$key]["descr"] = stripslashes($int_res["descr"]);
               
                                if ($result[$key]["descr"] == strip_tags($result[$key]["descr"]))
                                        $result[$key]["descr"] = str_replace("\n", "
", $result[$key]["descr"]);

                                if (!empty($int_res["full_descr"]))
                                        $result[$key]["full_descr"] = stripslashes($int_res["full_descr"]);

                                if ($result[$key]["full_descr"] == strip_tags($result[$key]["full_descr"]))
                                        $result[$key]["full_descr"] = str_replace("\n", "
", $result[$key]["full_descr"]);
                        }
                }
        }
        return $result;
}


# determine how many products fit the query criteria.
$total_items = func_search_newproducts($query, $membership, $retcount="Y");

if ($total_items > 0)
{
        #
        # Prepare the page navigation
        #
        if(!isset($objects_per_page)) {
                if ($current_area == "C" || $current_area == "B")
                        $objects_per_page = $config["Appearance"]["products_per_page"];
                else
                        $objects_per_page = $config["Appearance"]["products_per_page_admin"];
        }
        $total_nav_pages = ceil($total_items/$objects_per_page)+1;

       
        # calculate the upper and lower LIMIT for the SQL statement
        if (($page == 1) || $page == "")
                {$lowerLimit = 0; }
        else
                {$lowerLimit = (($page - 1) * $objects_per_page); }
       
        if ($sortby == "price") { $sortorder = "$sql_tbl[pricing].$sortby";}
                else { $sortorder = "$sql_tbl[products].$sortby"; }

        if (!sortdirection || ($sortdirection == "") || ($sortdirection == "0")) {
                        $sort_dir = "desc";
                        $sortdirection = "0";
        }
        else {
                $sort_dir = "asc";
                $sortdirection = "1";
        }
}

# 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.
        $newproducts = func_search_newproducts($query, $membership, $retcount="N", $orderby="$sortorder $sort_dir", $limit="$lowerLimit, $objects_per_page");
}

# If I want to have a secondary sort with the product code? Haven't decided yet
#$newproducts = func_search_newproducts($query, $membership, $retcount="N", $orderby="$sortorder $sort_dir, $sql_tbl[products].productcode $sort_dir", $limit="$lowerLimit, $objects_per_page");


include $xcart_dir."/include/navigation.php";


# flag set that is used in home_main.tpl
$smarty->assign("main","newproducts");

$smarty->assign("newproducts_dayrange", $newproducts_dayrange);
$smarty->assign("sort_fields", $sort_fields);
$smarty->assign("days",$days);
$smarty->assign("sortby",$sortby);
$smarty->assign("sortdirection",$sortdirection);

# give the product array to smarty to make it available sitewide.
$smarty->assign("products",$newproducts);
$smarty->assign("first_item", $first_page+1);
$smarty->assign("last_item", min($first_page+$objects_per_page, $total_items));
$smarty->assign("total_items",$total_items);
$smarty->assign("navigation_script","newproducts.php?days=$days&sortby=$sortby&sort_direction=$sort_direction");

# create the location bar  xxx :: New Products
$location[] = array(func_get_langvar_by_name("lbl_newproducts"), "newproducts.php");
$smarty->assign("location",$location);

# This function will start the display of the .tpl's
func_display("customer/home.tpl",$smarty);

?>


Save as newproducts.tpl
Code:

{* $Id: newproducts.tpl,v 1.0.0.1 2005/09/23 01:00:00 jfc Exp $ *}
{* This uses
        $lng.lbl_newproducts_since        => "Products added since"
        $lng.lbl_newproducts                => "New Products"
*}


{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace:"/[\n]/":"
"}

{/if}
{capture name=dialog}

{assign var="tmp" value="0"}
{assign var="url" value="newproducts.php?"}

{* ext-1 - this could be moved to a new .tpl file *}
<font size="2">{$lng.lbl_newproducts_since}:
        {foreach from=$newproducts_dayrange key=name item=field}
        {if $name eq $days}{$field}{else}{$field}{/if}
        {/foreach}
</font>
{* ext-1 *}




{if $products ne "" }
<BR clear="left">
<HR size="1" noshade>

{/if}

{if !empty($products) && is_array($products)}
        {* ext-2 - this could be moved to a new .tpl file *}
        {if $sort_fields}
                <DIV align="right"><font size="2">
                        {$lng.lbl_sort_by}:
                        {foreach from=$sort_fields key=name item=field}
                                {if $name eq $sortby}[img]{$ImagesDir}/{if $sortdirection eq [/img]{/if}{$field}{if $name eq $sortby}{/if}
                        {/foreach}</font>
                </DIV>
        {/if}
        {* ext-2 *}       

        {if $total_pages gt 2}
               
{ include file="customer/main/navigation.tpl" }
                {/if}

        <HR size="1" width="100%">
        {include file="customer/main/products.tpl" products=$products}
{else}
        {$lng.txt_no_newproducts}
{/if}
{/capture}

{include file="dialog.tpl" title=$lng.lbl_newproducts content=$smarty.capture.dialog extra="width=100%"}

{ include file="customer/main/navigation.tpl" }


Save file as language.sql
Quote:

INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products','lbl_newproducts','New Products','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products added since (days)','lbl_newproducts_since','Products added since','Labels');

INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','24 hour label','lbl_newproducts_24hrs','24 Hours','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','3 day label','lbl_newproducts_3days','3 Days','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','7 day label','lbl_newproducts_7days','7 Days','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','30 days label','lbl_newproducts_30days','30 Days','Labels');


INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products add_date','lbl_newproducts_adddate','Add Date','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products add_date','lbl_newproducts_sku','SKU','Labels');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products add_date','lbl_newproducts_product','Title','Label s');
INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products add_date','lbl_newproducts_price','Price','Labels' );

INSERT INTO xcart_languages (code, descr,name,value,topic) VALUES ('US','New Products not found','txt_no_newproducts','No new products have been listed within timeframe you specified','Text');



Here is an example on my site. This site is a live site.
http://www.unconventionallapidarist.com/xcart/newproducts.php

MythNReality 09-23-2005 09:54 PM

Thanks James. Great work.

Followed the instruction but couldn't get the day to show up...here's my web: http://www.petadorn.com/store/newproducts.php

Had any one tried this yet? Was something that I did wrong or?


Thanks for the great work,

lapidarist 09-23-2005 11:27 PM

Quote:

Followed the instruction but couldn't get the day to show up...here's my web: http://www.petadorn.com/store/newproducts.php

Had any one tried this yet? Was something that I did wrong or?

It looks like the labels from the languages.sql file aren't getting loaded. I am not sure about all the different language settings.

Try adding your "Labels" and "Text" manually to the languages in the admin panel.

It looks like from your site that the label for "New Products" got added but the rest did not. Try adding a couple of labels and test it. You should see if you are getting any results.

- james -


LABEL
=================================
Name: lbl_newproducts
Value: [i] New Products

Name: lbl_newproducts_since
Value: Products added since

Name: lbl_newproducts_24hrs
Value: 24 Hours

Name: lbl_newproducts_3days
Value: 3 Days

Name: lbl_newproducts_7days
Value: 7 Days

Name: lbl_newproducts_30days
Value: 30 Days

Name: lbl_newproducts_adddate
Value: Add Date

Name: lbl_newproducts_sku
Value: SKU

Name: lbl_newproducts_product
Value: Title

Name: lbl_newproducts_price
Value: Price


TEXT
======================================
Name: txt_no_newproducts
Value: No new products have been listed within timeframe you specified

MythNReality 09-24-2005 11:40 AM

Quote:

Originally Posted by lapidarist

Try adding your "Labels" and "Text" manually to the languages in the admin panel.

Try adding a couple of labels and test it. You should see if you are getting any results.

Name: lbl_newproducts_since
Value: Products added since


Magic!!! Thank you sooo much James, I think you've got a magic wand in your hand!
Right now the only thing is the [i]lbl_newproducts_since
I've got an error message says: The label for language selected is invalid. Please select another label.

I'm almost there! :lol:

lapidarist 09-24-2005 11:50 AM

Quote:

Right now the only thing is the [i]lbl_newproducts_since
I've got an error message says: The label for language selected is invalid. Please select another label.


Take the "[i]" off the label name. It was used as emphasis for this listing it to this forum. I guess I went a little crazy with them.

The label name should be:

lbl_newproducts_since


The value is the same as before.

- james -

MythNReality 09-24-2005 11:59 AM

Quote:

Originally Posted by lapidarist
Take the "[i]" off the label name. It was used as emphasis for this listing it to this forum. I guess I went a little crazy with them.

The label name should be:

lbl_newproducts_since

The value is the same as before.

- james -


:P =D> Hugs to you...I did that, and forgot to refresh my browser. Shame on me!
Now I am ready to do the hooter dance!!! :-({|= \:D/

fuzzy 09-24-2005 04:58 PM

GREAT Job James!! :D
This is about the first mod that installed without having to tweak this or that.
Come to think about it, it was rather boring. Just copy, paste, save, upload, patch...enjoy! :wink:

fuzzy 09-24-2005 06:03 PM

Well... I did have to make 1 tweak.
I noticed the "Manufacturers" menu wasn't showing, so...
In "newproducts.php" just below:
Code:

require "./auth.php";

require $xcart_dir."/include/categories.php";

I added:
Code:

if ($active_modules["Manufacturers"])
    include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php";


Now this may not be the correct way to do it, but it seems to work okay in 4.12 & 4.15.

yages 09-24-2005 06:31 PM

Great mod works great

Have a problem
I have put the link in the cartegories tpl

{section name=cat_num loop=$categories}
{if $categories[cat_num].order_by eq 20 ||
$categories[cat_num].order_by eq 100}

<div class="VertMenuItems1">New Products</div>
<hr>

I have the categories separated with a <hr>
the link shows in both areas of the category

Any suggestions how to only show the link in the top part of the categories

lapidarist 09-24-2005 06:46 PM

Quote:

Originally Posted by fuzzy
Well... I did have to make 1 tweak.
I noticed the "Manufacturers" menu wasn't showing, so...
In "newproducts.php" just below:
Code:

require "./auth.php";

require $xcart_dir."/include/categories.php";

I added:
Code:

if ($active_modules["Manufacturers"])
    include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php";


Now this may not be the correct way to do it, but it seems to work okay in 4.12 & 4.15.


I saw the same thing earlier and had already updated mine. Since it was my first xcart mod I stripped the code down to the minimum and rebuilt it to learn. I forgot to add the manufacturers reference that back in the code I posted. Oops.

I have gotten a lot of help from reading the forum. So, I thought it was time to give something back :-)

- james -

fuzzy 09-24-2005 07:37 PM

Quote:

Originally Posted by yages
Great mod works great

Have a problem
I have put the link in the cartegories tpl

{section name=cat_num loop=$categories}
{if $categories[cat_num].order_by eq 20 ||
$categories[cat_num].order_by eq 100}

<div class="VertMenuItems1">New Products</div>
<hr>

I have the categories separated with a <hr>
the link shows in both areas of the category

Any suggestions how to only show the link in the top part of the categories


Not sure if this helps, but I put mine like so:
Code:

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


yages 09-24-2005 08:11 PM

thanks Fuzzy works great

Lucent88 10-20-2005 02:55 PM

I'm on v.4.0.15. It works GREAT!

Just wondering, I see alot of people got it to work on the side menu like category, bestseller, and manufacturer.

Is that a separate .tpl page I have to create?

Or I just missed something here?

Amy 11-05-2005 08:46 PM

not quite sure why but my entire page is actually coming up but nothing within the page itself.

Page not found!
The requested page does not exist or you are not allowed to access it!

http://scrapbookbytes.com/store/newproducts.php

fuzzy 11-06-2005 04:35 AM

Quote:

Originally Posted by Amy
not quite sure why but my entire page is actually coming up but nothing within the page itself.

Page not found!
The requested page does not exist or you are not allowed to access it!

http://scrapbookbytes.com/store/newproducts.php


Just a guess, but is "newproducts.tpl" in the correct spot? ie:
/skin1/customer/main/newproducts.tpl
Also check the spelling of the {else} in /skin1/customer/home_main.tpl

If either isn't the prob, I'll need more coffee, and a donut or two. :wink:

Amy 11-06-2005 08:21 AM

very strange... all is in place and in place. I even replaced the include file on the home page... the minute I do the entire page goes blank.

Amy 11-06-2005 08:32 AM

also when removing all the content from the "newproduct.php" file and just putting in a "test" text into it - that does come up.

lapidarist 11-06-2005 09:41 AM

Quote:

Originally Posted by Amy
not quite sure why but my entire page is actually coming up but nothing within the page itself.

Page not found!
The requested page does not exist or you are not allowed to access it!

http://scrapbookbytes.com/store/newproducts.php



The "Page not found!" comes normally comes from the home_main.tpl file not having the following:


Code:

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


This has to be before the end of the file that says
Code:

{else}
{include file="common_templates.tpl"}
{/if}


The $main variable to set to "newproducts" in the newproducts.php file. If The {elseif} code shown above is not in home_main.tpl or you change the word "newproducts" to something else and didn't do the same in the .php file, you will get the page not found error because the code will fall through to the last statement that basically has it display the page not found page (in this case). Here is the bottom section of my <xcart_dir>/skin1/customer/home_main.tpl

Quote:


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

{else}
{include file="common_templates.tpl"}
{/if}

If you can't get it to work. Post your skin1/customer/home_main.tpl file. That is the best place to start looking. Because I can reproduce the error by taking out the {elseif} addition or changing the word (example. newproducts to newadditions)

James

Amy 11-06-2005 11:06 AM

thanks! Will give it a try in just a bit - I appreciate your help - it's a mod that my store visitors are begging for!

Amy 11-06-2005 11:37 AM

here is the main_home.tpl file.

when inserting that last line of code it creates a blank page to be created.

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 "newproducts"}
{include file="customer/main/newproducts.tpl"}

{else}
{include file="common_templates.tpl"}
{/if}


fuzzy 11-06-2005 11:53 AM

Are you using Word or Word Pad to edit the file?
If so, use Notepad instead.

Amy 11-06-2005 12:10 PM

I believe I did it in word pad; will try textpad

Amy 11-06-2005 12:23 PM

THAT WAS IT!!! YOU ROCK!!! Thanks so VERY VERY much for this mod!

lapidarist 11-06-2005 12:29 PM

Quote:

Originally Posted by Amy
I believe I did it in word pad; will try textpad


Sounds like you got some funky characters from your texteditor.

I see that you got it fixed.

Thanks fuzzy for the support.

- james -

fuzzy 11-06-2005 12:35 PM

Quote:

Originally Posted by lapidarist
Quote:

Originally Posted by Amy
I believe I did it in word pad; will try textpad


Sounds like you got some funky characters from your texteditor.

I see that you got it fixed.

Thanks fuzzy for the support.

- james -

No prob.
Using MS Word, Wordpad does add a bunch of unseen stuff that servers
will choke on.
So does FrontPage.
Gotta love MS! LOL!!

Amy 11-06-2005 12:39 PM

now to figure out how to link it from my categories navigation! :)

Amy 11-06-2005 12:45 PM

THANKS TO BOTH OF YOU!!!

Any input on adding it to my navigation or creating a new "box".

below is my categories.tpl page.

Code:

{capture name=menu}[img]http://scrapbook-bytes.com/images/b-1.gif[/img]{if
$active_modules.Fancy_Categories ne ""} {include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else} {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories}
{assign var=topmostcat value=$current_category.categoryid_path|regex_replace:"/\/.*/":""}
{if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid
|| $topmostcat eq $categories[cat_num].categoryid} {$categories[cat_num].category}

{else} {$categories[cat_num].category}

[img]http://scrapbook-bytes.com/images/line-1.gif[/img]{/if}
{if $cat eq $categories[cat_num].categoryid || $current_category.parentid eq $categories[cat_num].categoryid
|| $topmostcat eq $categories[cat_num].categoryid} {section name=subcat loop=$allcategories}
{if $allcategories[subcat].parentid eq $categories[cat_num].categoryid} <a href="home.php?cat={$allcategories[subcat].categoryid}" class="VertMenuItems">{if
$cat eq $allcategories[subcat].categoryid || $current_category.parentid eq $allcategories[subcat].categoryid}{/if}{$allcategories[subcat].category}{if
$cat eq $allcategories[subcat].categoryid || $current_category.parentid eq $allcategories[subcat].categoryid}
{/if}</a>

{if $cat eq $allcategories[subcat].categoryid || $allcategories[$cat].parentid
eq $allcategories[subcat].categoryid || $current_category.parentid eq $allcategories[subcat].categoryid}
&gt;{section name=subcat2 loop=$allcategories} {if $allcategories[subcat2].parentid
eq $allcategories[subcat].categoryid || $current_category.parentid eq $subcategories[subcat2].categoryid}
<a href="home.php?cat={$allcategories[subcat2].categoryid}" class="VertMenuItems">{if
$cat eq $allcategories[subcat2].categoryid}{/if}{$allcategories[subcat2].category}{if
$cat eq $allcategories[subcat2].categoryid}
{/if}</a>

{/if} {/section} {/if} {/if} {/section} [img]http://scrapbook-bytes.com/images/line-1.gif[/img]{/if}
[img]http://scrapbook-bytes.com/images/b-1.gif[/img]{/section}
{else} {section name=cat_num loop=$subcategories} <FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT>
 
{/section}
{/if}
{/if}
{/capture}
{include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu}


Amy 11-06-2005 12:56 PM

what about an "added date: " field to each product?

Amy 11-06-2005 03:35 PM

Re: .
 
Quote:

Originally Posted by raxitpatel
Is there a Way to Display New added Products Catagorywise - If customer visits specific catagory he can see new products added in that specific main catagory?


input on this one?

JWait 12-11-2005 06:23 AM

Along the same lines as the question posted above...

Is there any way to add "By Date" to the Sort options in each category?

I installed this mod in 4.0.17 and it works like a charm! Great Mod! :D

Amy 01-05-2006 04:10 AM

Here's one for ya..... Any way for this to NOT include "changed" or "updated" products (ie: if someone changes a price in their provider area) as "new".


All times are GMT -8. The time now is 04:24 PM.

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