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)
-   -   Special Offers Module (https://forum.x-cart.com/showthread.php?t=1144)

BHMedia 09-29-2004 07:56 PM

sweet

finestshops 10-06-2004 07:30 AM

Quote:

Originally Posted by enge919
Have any idea what to change in the script to get it to work properly with 4.0.3?


Change specials.php to this one:

Code:

<?
#
# $Id: specials.php by FS based on featured_products.php,v 1.2.2.3 2004/09/09 12:12:41 max Exp $
# specials mod idea by funkydunk
# Get featured products data and store it into $specials 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 = "";
$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 price < list_price ORDER BY RAND() LIMIT 6 ";
$specials = func_query($query);

if(is_array($specials)){
    foreach($specials 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($specials[$f_v]['productid'], @$user_account['membership']);
                                if ($tmp_price)
                                        $specials[$f_v]["price"] = $tmp_price;
                        }

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

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

#
# Check if product have product options
#
                        if(!empty($active_modules['Product_Options'])) {
                                $specials[$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"])) {
                                $specials[$f_v]["product"] = stripslashes($int_res["product"]);
                    }   
                if (!empty($int_res["descr"])) {
                            $specials[$f_v]["descr"] = str_replace("\n","
", stripslashes($int_res["descr"]));
                    }   
                    if (!empty($int_res["full_descr"])) {
                        $specials[$f_v]["fulldescr"] = str_replace("\n","
", stripslashes($int_res["full_descr"]));
                    }

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

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

                }       
        }
}; 


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

?>


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

:wink:

Online Michael 07-02-2005 07:38 AM

Quote:

Originally Posted by shan
Anyone created this as a side menu like the bestsellers has ?


Your wish is my command.... :wink: Here is the code:

Replace the entire code in the specials.tpl with this:

Code:

{* $Id: specials.tpl,v 1.3.2.1 2004/11/16 11:15:01 max Exp $ *}
{if $specials ne ""}
{capture name=specials}
<TABLE cellpadding="0" cellspacing="2" border="0">
{section name=num loop=$specials}
<TR>
<TD width="30">
{include file="product_thumbnail.tpl" productid=$specials[num].productid image_x=25 product=$specials[num].product}
</TD>
<TD>
{$specials[num].product}

<S>{include file="currency.tpl" value=$specials[num].list_price}</S>
Now:{include file="currency.tpl" value=$specials[num].price}

</TD>
</TR>
{/section}
</TABLE>
{/capture}
{include file="menu.tpl" menu_title= "Hot Specials" menu_content=$smarty.capture.specials extra="width=100%"}
{/if}


Insert the following line of code where ever you want the specials to appear in the skin1/customer/home.tpl file:

Code:

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

That's about it...enjoy :D

Oh, and btw, this works fine on 4.0.13

torola 07-13-2005 04:02 PM

Hello,

I am kind of lost here, can somone please recap and put all mods together, and show final instructions exactly what needs to be done to get this mod to be working.

Thanks you,

torola 07-14-2005 06:26 AM

Hi, me again I figured it out, its working, great!

However is there a way to select a category or categories from which you only want to show the discouted products in the "Hot specials" list?

I mean I have 10 categories, but I only want to show products from 3 of them in the "Hot specials" list.

Thanks
Tom

chamberinternet 10-07-2005 09:12 AM

Hello ..

Will this mod work with v4.0.15 ?

Thanks & Regards

:sK

chamberinternet 10-09-2005 05:00 AM

Quote:

Originally Posted by chamberinternet
Will this mod work with v4.0.15 ?


Yup ... seems to ...

:sK

yages 10-17-2005 12:35 PM

How do you limit this mod to to show only one category

Online Michael 10-17-2005 05:00 PM

yages,

check out this Clearance mod if you just want one category limit:

http://forum.x-cart.com/viewtopic.php?t=20781&highlight=
Hope this helps :)

micromedia 11-13-2005 06:31 PM

Hello,

I am kind of lost here, can somone please recap and put all mods together, and show final instructions exactly what needs to be done to get this mod to be working.

Thanks you,


All times are GMT -8. The time now is 06:26 AM.

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