X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to display the price of a specific productid? (https://forum.x-cart.com/showthread.php?t=5884)

jordan0 01-06-2004 04:46 PM

How to display the price of a specific productid?
 
hi Б─⌠ i've got an easy one:
How do i simply display the price of a specified item in the catalog?
I've tried
Code:

{include file="currency.tpl" value=$products[393].price}
with no success. I guess the $products array doesn't use the productid's to identify the items in it?

I am trying to display the price of the item with the xcart-given productid of 393. This is in a customized products.tpl template that is loaded with the following command:
Code:

{include file="customer/main/products_struc_stripstick.tpl" products=$products}
I'm hard-coding all of the price references because I don't think I could wrap my head around trying to automatically generate a chart like this with smarty. The inventory is hardly ever going to change anyway...

Y'all can see what I'm talking about: http://www.kitkraft.biz/customer/home.php?cat=35

*** Update (removed first one Б─⌠ no longer relevant) ***

So I found how to get the prices, and how to get the array in the right order (It was because of mod_sort, as I suspected).

But... I have a new problem:
The $products array only contains the price info on the first 12 products, because thats what I have set my "maximum products per page" option to in the admin section. I have tried modifying the products.php to put a different value into $objects_per_page, but that variable apparently doesn't have to do with what goes in the $products array.
I think I'm right in assuming that somewhere in products.php, $config["Appearance"]["products_per_page"] is used to determine how much info gets put into $products. Based on that, though, I can't seem to figure this one out.
My goal is to make it so that $products contains all of the pricing info for the whole category, not just one page at a time. I'll have to work this into an if statement that only does this for those categories which need it.

Any of you experts out there been through this already?

jordan0 01-06-2004 10:39 PM

Re: How to display the price of a specific productid?
 
Well damn! I resolved this one immediately after I posted the last message. For anyone else out there in the same boat, heres what I found:

In products.php, the $first_page in the code below restricts what goes into $products to whatever is on the first page (duh right?)
Code:

$products = func_search_products($search_query, $user_account['membership'], $first_page,$current_category["product_count"]);
if (count($products) ==0) $products="";


So to solve my problem, I just made an if statement that removes when I need all of the prices for the whole category:
Code:

if ($cat == "35") {
$products = func_search_products($search_query, $user_account['membership'],$current_category["product_count"]);
if (count($products) ==0) $products="";
} else {
$products = func_search_products($search_query, $user_account['membership'], $first_page,$current_category["product_count"]);
if (count($products) ==0) $products="";
}


I wonder if this will ever help anyone...


All times are GMT -8. The time now is 02:42 PM.

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