Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I tried this to no avail. Any other suggestions?

Are you sure you changed the $new_product_query/queries in that module? Looks like you have a template one, so it might be different than the standard osC.

Link to comment
Share on other sites

Have added the following code in producting_listing.php and it removed the duplicate records - Thank you Jan

 

while ($_listing = tep_db_fetch_array($listing_query)) {
// in first iteration $_list_of_prdct_ids is not an array yet
if (isset($_list_of_prdct_ids) && (! in_array($_listing['products_id'], $_list_of_prdct_ids))) {
    $listing[] = $_listing;
}
    $_list_of_prdct_ids[] = $_listing['products_id'];
    } // end while ($_listing = tep_db_fetch_array($listing_query))
// no duplicate product_id's:
$list_of_prdct_ids = array_unique($_list_of_prdct_ids);
$no_of_listings = count($list_of_prdct_ids);

 

Problem I have is that previously I had sold out products entries being displayed correctly. Following adding of the above code the sold out entry is listed as "No Image Available" no other details and a price $0.00

 

Can any one suggest changes I need to make while still having the duplicates removed

 

Thanking you in advance

Link to comment
Share on other sites

roblem I have is that previously I had sold out products entries being displayed correctly. Following adding of the above code the sold out entry is listed as "No Image Available" no other details and a price $0.00

 

Can any one suggest changes I need to make while still having the duplicates removed.

That piece of code doesn't remove any info, so there must be something else going on (did you change $listing['field'] to $listing[$x]['field'] everywhere?). Otherwise post the code of your product listing.

Link to comment
Share on other sites

To me it sounds like you got an over-complicated shop now. SPPC addresses pricing if not all customers get the same pricing (so you have groups of customers with different prices, say retail and wholesale). You seem to be using it as a discount module.

I would assume you would be better off just using the Quantity Price Breaks Per Product contribution with the tweaks (that would take a fair amount of work though) I mentioned.

 

Thanks again for replying.

 

You are correct. Now that SPPC w/Price Breaks has been configured to account for category price breaks, that should fulfill all my needs in this area. But, a couple of issues have sprung up...

 

I've installed the SPPC-PBPC with all the updates for categories, etc. I've noticed a couple of issues that I hope you can shed some light on:

  1. This one is a serious issue. I've installed SPPC-PBPC and used the admin panel to add price breaks to products within several different main-level categories. But, SPPC-PBPC is applying the price breaks much more broadly than it should. Instead of using the total number of products per category to trigger the price breaks, the price breaks are being triggered by the total shopping cart quantity of products, not the category quantity. For example, the Category A price break trigger is 5 products, but the price break is being applied even when the cart contains 4 products from Category A and 1 product from Category D. (Category D is an independent category, not a subcategory of Category A.) Any time the cart contains at least 5 products (of any category), the price break for Category A is being triggered, even if the cart contains less than 5 Category A products. The same is true for products of any category in the cart. All price breaks are being triggered by the total shopping cart quantity, not the category quantity.
  2. This 2nd issue pertains to categories and subcategories. I have a main category with several subcategory levels within that main category. Is SPPC-PBPC supposed to treat these subcategories as if they are independent categories, or does it treat all subcategory levels within a main category as being part of the main category? As a suggestion, I wonder if the admin panel could allow us to choose which level of category/subcategories the price break should apply to. When a product is part of a subcategory, the admin panel could inquire: "This product is in Main Category X, Subcategory Y, and Subcategory Z. Choose the level where the price break for this product should apply." In any case, I need to know which way SPPC-PBPC is supposed to handle subcategories.

I've combed through the installation instructions for SPPC-PB and SPPC-PBPC several times, to make sure I didn't make a mistake while updating the code and php files, and I cannot find any error on my part. I hope maybe you know what the problem is.

 

Also, I believe I found a syntax error in your "install.txt" file for SPPC_Price_Break_v1_02. See lines 1209 and 1210 of that "install.txt" file, in the update instructions for admin/categories.php. Shouldn't there be a "?>" in between those two lines -- after the "}"? The file returned an error when I tried to run it without the "?>" in there.

 

Again, thanks very, very much for your help.

Link to comment
Share on other sites

I've installed the SPPC-PBPC with all the updates for categories, etc. I've noticed a couple of issues that I hope you can shed some light on:
  1. This one is a serious issue. I've installed SPPC-PBPC and used the admin panel to add price breaks to products within several different main-level categories. But, SPPC-PBPC is applying the price breaks much more broadly than it should. Instead of using the total number of products per category to trigger the price breaks, the price breaks are being triggered by the total shopping cart quantity of products, not the category quantity. For example, the Category A price break trigger is 5 products, but the price break is being applied even when the cart contains 4 products from Category A and 1 product from Category D. (Category D is an independent category, not a subcategory of Category A.) Any time the cart contains at least 5 products (of any category), the price break for Category A is being triggered, even if the cart contains less than 5 Category A products. The same is true for products of any category in the cart. All price breaks are being triggered by the total shopping cart quantity, not the category quantity.
  2. This 2nd issue pertains to categories and subcategories. I have a main category with several subcategory levels within that main category. Is SPPC-PBPC supposed to treat these subcategories as if they are independent categories, or does it treat all subcategory levels within a main category as being part of the main category? As a suggestion, I wonder if the admin panel could allow us to choose which level of category/subcategories the price break should apply to. When a product is part of a subcategory, the admin panel could inquire: "This product is in Main Category X, Subcategory Y, and Subcategory Z. Choose the level where the price break for this product should apply." In any case, I need to know which way SPPC-PBPC is supposed to handle subcategories.

I've combed through the installation instructions for SPPC-PB and SPPC-PBPC several times, to make sure I didn't make a mistake while updating the code and php files, and I cannot find any error on my part. I hope maybe you know what the problem is.

As you found out there are some issues with the SPPC-PBPC mod that was included in SPPC_Price_Break_v1_02. That is why it is not found in the latest version (which is very much more efficient regarding sql queries, in that version the PriceFormatter class is called 5 times per item in the cart...).

 

One of the issues is that categories_id was not added to the list of fields in the $sql of the function loadProduct in PriceFormatter.php. Therefore, you get a NULL for all products as you found in your first issue.

 

The other issue (which I did not think of when I wrote that mod) is that a product can be in more than one category (if so the results are disastrous). That is why the "discount category id" should not be the one from the table products_to_categories but from a separate one with products_id as a key. That would solve your issue 2 but that is also the reason why I mentioned that adding this functionality is a fair amount of work. So it is rather an unfinished mod.

 

Also, I believe I found a syntax error in your "install.txt" file for SPPC_Price_Break_v1_02. See lines 1209 and 1210 of that "install.txt" file, in the update instructions for admin/categories.php. Shouldn't there be a "?>" in between those two lines -- after the "}"? The file returned an error when I tried to run it without the "?>" in there.

In my version line 1209 and 1210 are:

			<td class="main"><?php if ($customer_prices_set == true) {
	$sppc_cg_products_qty_blocks = $attributes['products_qty_blocks'];

There should not be a "?>" in there.

Link to comment
Share on other sites

I am looking to have a seperate price for distrubutors to the public on my site? Also distributors would need a higher minimum order than the public? Is this the add on I need?

Separate minimum orders is not handled by this contribution but can be easily added adding the minimum order amounts as the constant plus the customer group id (something like MINIMUM_ORDER_AMOUNT1) and instead of then using MINIMUM_ORDER_AMOUNT in the code (after having established $customer_group_id in the code before it): constant(MINIMUM_ORDER_AMOUNT.$customer_group_id)

The rest of the code can be taken from the appropriate "minimum order amount" contribution (check the contribution section). This has come up in the thread before, so perhaps you can find which one that is in here too.

Link to comment
Share on other sites

As you found out there are some issues with the SPPC-PBPC mod that was included in SPPC_Price_Break_v1_02. That is why it is not found in the latest version (which is very much more efficient regarding sql queries, in that version the PriceFormatter class is called 5 times per item in the cart...).

 

One of the issues is that categories_id was not added to the list of fields in the $sql of the function loadProduct in PriceFormatter.php. Therefore, you get a NULL for all products as you found in your first issue.

 

The other issue (which I did not think of when I wrote that mod) is that a product can be in more than one category (if so the results are disastrous). That is why the "discount category id" should not be the one from the table products_to_categories but from a separate one with products_id as a key. That would solve your issue 2 but that is also the reason why I mentioned that adding this functionality is a fair amount of work. So it is rather an unfinished mod.

In my version line 1209 and 1210 are:

			<td class="main"><?php if ($customer_prices_set == true) {
	$sppc_cg_products_qty_blocks = $attributes['products_qty_blocks'];

There should not be a "?>" in there.

 

Jan,

 

Do I understand you to mean the first issue can be solved fairly easily with some modifications to the $sql of the function loadProduct in PriceFormatter.php? I can find that part of the code. Is it as simple as adding a line that reads:

 

" p.categories_id," .

 

to the $sql in the loadProduct function?

 

I see what you mean about this functionality being a lot of work. Since you say you've left SPPC-PBPC out of the most recent version, does that mean it just won't work as currently written? Or, can it be made to work using the previous version SPPC_Price_Break_v1_02, which you uploaded on Jan 31, 2007, if it is configured or tweaked the right way?

 

Lastly, I gave you the wrong line numbers when I tried to point out the syntax error. See lines 1191 and 1192 of your "install.txt" file for SPPC_Price_Break_v1_02. I show those two lines as:

 

	  }
 </td>

 

Shouldn't there be a "?>" in between those two lines?

 

Thanks again.

Link to comment
Share on other sites

Do I understand you to mean the first issue can be solved fairly easily with some modifications to the $sql of the function loadProduct in PriceFormatter.php? I can find that part of the code. Is it as simple as adding a line that reads:

 

" p.categories_id," .

 

to the $sql in the loadProduct function?

Yes.

 

I see what you mean about this functionality being a lot of work. Since you say you've left SPPC-PBPC out of the most recent version, does that mean it just won't work as currently written? Or, can it be made to work using the previous version SPPC_Price_Break_v1_02, which you uploaded on Jan 31, 2007, if it is configured or tweaked the right way?

Oh surely it can be made to work with the latest version. It is just that the idea of using products_to_categories to get a category_id being fundamentally flawed because a product can be in several categories, the fact that making it work correctly would take considerable time (because a page would be needed where to add "discount categories") and not many people seemed to want to use it made me leave it out of the last version.

 

Actually, I had the impression that it somehow had disappeared from the contributions but apparently I was wrong ;)

 

Lastly, I gave you the wrong line numbers when I tried to point out the syntax error. See lines 1191 and 1192 of your "install.txt" file for SPPC_Price_Break_v1_02. I show those two lines as:

 

	  }
 </td>

 

Shouldn't there be a "?>" in between those two lines?

Yes, you are 100% right (there is ?> on a separate line in the included categories.php by the way).

Link to comment
Share on other sites

That piece of code doesn't remove any info, so there must be something else going on (did you change $listing['field'] to $listing[$x]['field'] everywhere?). Otherwise post the code of your product listing.

 

 

Yes I do use $listing[$x]['field'] everywhere

Link to comment
Share on other sites

Oh surely it [sPPC-PBPC] can be made to work with the latest version. It is just that the idea of using products_to_categories to get a category_id being fundamentally flawed because a product can be in several categories, the fact that making it work correctly would take considerable time (because a page would be needed where to add "discount categories") and not many people seemed to want to use it made me leave it out of the last version.

 

Jan,

 

I can live with that fundamental flaw for the time being, if only I could get the SPPC-PBPC module to work at all. I need it rather urgently.

 

At present, I intend for price breaks to apply to only one category. None of my products belong to more than one category. (I have products that belong to a couple of subcategories within that main category, but no product belongs to more than one main category or more than one subcategory.)

 

All I need is for products from other categories in the shopping cart to be ignored when SPPC-PBPC decides whether to apply the price break to my one category that includes price breaks. (As you'll recall, at present the total shopping cart quantity is triggering the price breaks, regardless of category.) I can live with the "fundamental flaw" about multiple categories because it doesn't apply to me.

 

If you can suggest the proper fix to make SPPC-PBPC apply the price breaks based on the category quantity instead of the total shopping cart quantity, I would be forever grateful.

 

I modified the $sql in the loadProduct() function in PriceFormatter.php and in the PriceFormatterStore() function in PriceFormatterStore.php, but it didn't make any difference.

 

Thanks very much for any help you can offer.

Link to comment
Share on other sites

which file in the contrib downloads is the latest version of the SPPC contrib?

 

 

can I rephrase that- I have a fresh install of OS Commerce with the reg globals fix contrib added first. I have added the SPPC version 4.15 by copying and pasting onto my server then add the Hide products from customer groups using SPPC contrib version 2.02. Now I get the message again:

 

Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.

 

Which looks like the SPPC and Hide contribs have overided the reg globals fix contrib.

If i add the register globals fix contrib again that will overide some code from the other two contribs won't it so what should I do?

Link to comment
Share on other sites

Went through it all manually and got SPPC working but am having a major error when I click on catalog in the admin:

Parse error: parse error, unexpected '*' in /home/content/W/O/R/WORLDOFMOTION/html/shop2/admin/categories.php on line 279

 

So I checked it out in categories.php.

 

...and I remember that there was something I didn't wuite understand in the instruction file:

 

Line 247

 

**AFTER**

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

}

 

**ADD**

// BOF Separate Pricing Per Customer

$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");

while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups

{

$attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");

$attributes = tep_db_fetch_array($attributes_query);

if (tep_db_num_rows($attributes_query) > 0) {

if ($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked

if ( ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] <> $attributes['customers_group_price']) && ($attributes['customers_group_id'] == $customers_group['customers_group_id']) ) {

tep_db_query("update " . TABLE_PRODUCTS_GROUPS . " set customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "' where customers_group_id = '" . $attributes['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

elseif (($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] == $attributes['customers_group_price'])) {

$attributes = tep_db_fetch_array($attributes_query);

}

}

else {

tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $customers_group['customers_group_id'] . "' and products_id = '" . $products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

}

}

elseif (($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) && ($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] != '')) {

tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (products_id, customers_group_id, customers_group_price) values ('" . $products_id . "', '" . $customers_group['customers_group_id'] . "', '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "')");

$attributes = tep_db_fetch_array($attributes_query);

}

 

}

// EOF Separate Pricing Per Customer

 

**AFTER** in case 'copy_to_confirm':

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

 

 

// BOF Separate Pricing Per Customer 26042006 by Infobroker

 

$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");

while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups

{

$attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");

$attributes = tep_db_fetch_array($attributes_query);

 

tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (customers_group_id, customers_group_price, products_id) values ('" . $attributes['customers_group_id'] . "', '" . tep_db_input($attributes['customers_group_price']) . "', '" . (int)$dup_products_id . "')");

 

 

 

}

// EOF Separate Pricing Per Customer 26042006 by Infobroker

 

The bit I've highlighted, what do do? I've added everything before that, but do I search for 'in case 'copy_to_confirm':' or not?

 

Sorry, just a bit confused, I seem to have it all working (touchwood) apart from this now.

 

Thanks

Link to comment
Share on other sites

Struggling with this one too:

 

When I logon on as 'wholesale', all the specials dissapear. I see this is because my special items are only listed for the 'retail' group. Now, I want the specials to apply to both groups e.g say I have 10% off a product, I want that to be 10% off retail AND wholesale price. Anyway possible?

 

Thanks

''

Link to comment
Share on other sites

If you can suggest the proper fix to make SPPC-PBPC apply the price breaks based on the category quantity instead of the total shopping cart quantity, I would be forever grateful.

 

I modified the $sql in the loadProduct() function in PriceFormatter.php and in the PriceFormatterStore() function in PriceFormatterStore.php, but it didn't make any difference.

My crystal ball has broke so I couldn't check the modifications you made to your code, but one of the things I wanted to check is if you added products_to_categories to the sql and if you added the category_id to the function addPriceBreakData in PriceFormatterStore (similar change probably needed in PriceFormatter too).

 

Check if the category id shows up in PriceFormatterStore by echo'ing it in the footer e.g.:

echo '<pre>';
print_r($pfs);

Link to comment
Share on other sites

Struggling with this one too:

 

When I logon on as 'wholesale', all the specials dissapear. I see this is because my special items are only listed for the 'retail' group. Now, I want the specials to apply to both groups e.g say I have 10% off a product, I want that to be 10% off retail AND wholesale price. Anyway possible?

In the admin for the specials you need to make a special for each group. So you need to add it for the wholesale group too.

Link to comment
Share on other sites

In the admin for the specials you need to make a special for each group. So you need to add it for the wholesale group too.

 

Thanks Jan, but when I create a special in this way for one group; the product dissappears from the list for the other group. Making it unselectable for two groups?

 

Also Jan, when I give a product a 'group price' on the product information page and then click 'update' I get this:

 

1062 - Duplicate entry '1-0' for key 1

 

insert into products_groups (customers_group_id, customers_group_price, products_id) values ('1', '25.0000', '0')

 

[TEP STOP]

 

The page works fine when I don't use a group price and the request still seems to succeed despite the error. I suspect this may have something to do with my misreading of the instructions posted a few post earlier?

 

I really appreciate your time, help and skills.

Link to comment
Share on other sites

I think I have installed this correctly and I am testing it out. I have found that adding products, categories and customer groups is fine ans have tested the hidden categories/producs feature but when you click logoff you see ALL the categories available

Link to comment
Share on other sites

Went through it all manually and got SPPC working but am having a major error when I click on catalog in the admin:

So I checked it out in categories.php.

 

...and I remember that there was something I didn't wuite understand in the instruction file:

The bit I've highlighted, what do do? I've added everything before that, but do I search for 'in case 'copy_to_confirm':' or not?

The code that handles the case 'copy_to_confirm" starts around line 300. About 28 lines further you will find the bit: tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

So you insert the new code after that. Below is the code (slightly different) that I use inserted there. For reference a number of lines of code below it are posted too:

 

			tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
					// BOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker
  $cg_price_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' order by customers_group_id");

// insert customer group prices in table products_groups when there are any for the copied product
if (tep_db_num_rows($cg_price_query) > 0) {
  while ( $cg_prices = tep_db_fetch_array($cg_price_query)) {
	tep_db_query("insert into " . TABLE_PRODUCTS_GROUPS . " (customers_group_id, customers_group_price, products_id) values ('" . (int)$cg_prices['customers_group_id'] . "', '" . tep_db_input($cg_prices['customers_group_price']) . "', '" . (int)$dup_products_id . "')");
  } // end while ( $cg_prices = tep_db_fetch_array($cg_price_query))
} // end if (tep_db_num_rows($cg_price_query) > 0)

// EOF Separate Pricing Per Customer originally 2006-04-26 by Infobroker
		$products_id = $dup_products_id;
	  }

	  if (USE_CACHE == 'true') {
		tep_reset_cache_block('categories');
		tep_reset_cache_block('also_purchased');
	  }
	}

	tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
	break;
  case 'new_product_preview':

Link to comment
Share on other sites

Thanks Jan, but when I create a special in this way for one group; the product dissappears from the list for the other group. Making it unselectable for two groups?

That is an error I haven't heard before. Did you try the admin/specials.php page from the package?

 

Also Jan, when I give a product a 'group price' on the product information page and then click 'update' I get this:

The page works fine when I don't use a group price and the request still seems to succeed despite the error. I suspect this may have something to do with my misreading of the instructions posted a few post earlier?

That sql is used (only it seems) in that copy_to_confirm part so yes that could be.

Link to comment
Share on other sites

My crystal ball has broke so I couldn't check the modifications you made to your code, but one of the things I wanted to check is if you added products_to_categories to the sql and if you added the category_id to the function addPriceBreakData in PriceFormatterStore (similar change probably needed in PriceFormatter too).

Jan,

 

Sorry about that crystal ball issue. I added categories_id to the $sql statement in the function loadProduct, as you suggested. Find the code below.

 

Edited the files "PriceFormatter.php" and "PriceFormatterStore.php" that were included in SPPC_Price_Break_update_v2_for_v1_02.

 

In PriceFormatter.php:

Near line 211, see the function loadProduct($product_id, $language_id=1).

Near line 226, see the $sql statement in that function, modified with the lines that have your name in comment:

 

	$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" c.categories_id," .					// added this line per JanZ's suggestion
	" p.products_price, p.products_weight, p.products_quantity, " .
	" p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8," .
	" p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .
	" p.products_tax_class_id," .
	" NULL as specials_new_products_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_CATEGORIES . " c," .			  // added this line per JanZ's suggestion
	"	  " . TABLE_PRODUCTS . " p" .	   
//   BOF Price Break for SPPC mod, price break per category
" LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " using(products_id) " . 
//   EOF Price Break for SPPC mod, price break per category
	" where p.products_status = '1'" .
	"   and p.products_id = '" . (int)$product_id . "'" .
	"   and pd.products_id = '" . (int)$product_id . "'" .
	"   and pd.language_id = '". (int)$language_id ."'";

Then, in PriceFormatterStore.php:

Near line 18, see the function PriceFormatterStore().

Near line 41, see the $sql statement in that function, modified with the lines that have your name in comment:

 

	$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" c.categories_id," .								 // JanZ
	" p.products_price, p.products_weight, p.products_quantity, " .
	" p.products_price1, p.products_price2, p.products_price3, p.products_price4, " . 
	" p.products_price5, p.products_price6, p.products_price7, p.products_price8, " .
	" p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, " .
	" p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, " .
	" p.products_qty_blocks, p.products_tax_class_id," .
	" NULL as specials_new_products_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_CATEGORIES . " c," .				   // JanZ
	"	  " . TABLE_PRODUCTS . " p" .
	" where p.products_status = '1'" .
	"   and p.products_id in (" . $product_id_list . ")" .
	"   and pd.products_id = p.products_id " .
	"   and pd.language_id = '". (int)$languages_id ."'";

 

From what you said above, it sounds like other edits might be necessary?

 

 

Check if the category id shows up in PriceFormatterStore by echo'ing it in the footer e.g.:

echo '<pre>';
print_r($pfs);

 

After I added the 2 lines of code you suggested to footer.php, then loaded my web site and placed 1 product in the shopping cart, here's the text that showed up at the bottom of the shopping cart page, just as you see it below:

 

priceformatterstore Object
(
[pricebreaks] => Array
	(
		[75] => Array
			(
				[products_id] => 75
				[products_price] => 27.8000
				[products_name] => E04-747J00
				[products_model] => 
				[products_weight] => 0.00
				[products_quantity] => 120
				[products_tax_class_id] => 1
				[products_image] => E04-747J00.jpg
				[products_qty_blocks] => 1
				[specials_new_products_price] => 
				[products_price1_qty] => 12
				[products_price2_qty] => 0
				[products_price3_qty] => 0
				[products_price4_qty] => 0
				[products_price5_qty] => 0
				[products_price6_qty] => 0
				[products_price7_qty] => 0
				[products_price8_qty] => 0
				[products_price1] => 13.9000
				[products_price2] => 0.0000
				[products_price3] => 0.0000
				[products_price4] => 0.0000
				[products_price5] => 0.0000
				[products_price6] => 0.0000
				[products_price7] => 0.0000
				[products_price8] => 0.0000
			)

	)

[cg_id] => 1
)

 

Thanks very much for any ideas you can come up with to cause SPPC-PBPC to use the category quantity to trigger the price breaks instead of the total shopping cart quantity.

Link to comment
Share on other sites

Are you sure you changed the $new_product_query/queries in that module? Looks like you have a template one, so it might be different than the standard osC.

 

 

I'm not sure what you mean by this, what module? A template of what?

 

I appreciate your help.

Link to comment
Share on other sites

That is an error I haven't heard before. Did you try the admin/specials.php page from the package?

That sql is used (only it seems) in that copy_to_confirm part so yes that could be.

 

Hi Jan,

 

Many thanks, the code for the categories is working 100%. Superb. Thanks.

 

However, my specials problem still remains ie. I can't create a special for a single product for more than one group. Would you be able to advise as to what to check in admin/specials.php.

 

It looks like this at the moment:

<?php
/*
 $Id: specials.php,v 1.41 2003/06/29 22:50:52 hpdl Exp $
adapted for Separate Pricing Per Customer v4.0 2005/01/29
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
 // BOF Separate Pricing Per Customer
  $customers_groups_query = tep_db_query("select customers_group_name, customers_group_id from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
while ($existing_groups =  tep_db_fetch_array($customers_groups_query)) {
	 $input_groups[] = array("id"=>$existing_groups['customers_group_id'], "text"=> $existing_groups['customers_group_name']);
	$all_groups[$existing_groups['customers_group_id']]=$existing_groups['customers_group_name'];
}
// EOF Separate Pricing Per Customer

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
switch ($action) {
  case 'setflag':
	tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']);

	tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL'));
	break;
  case 'insert':
	$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
	$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
	$day = tep_db_prepare_input($HTTP_POST_VARS['day']);
	$month = tep_db_prepare_input($HTTP_POST_VARS['month']);
	$year = tep_db_prepare_input($HTTP_POST_VARS['year']);
	// BOF Separate Pricing Per Customer
	$customers_group=tep_db_prepare_input($HTTP_POST_VARS['customers_group']);
	$price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS. " WHERE products_id = ".(int)$products_id . " AND customers_group_id  = ".(int)$customers_group);
	while ($gprices = tep_db_fetch_array($price_query)) {
		$products_price = $gprices['customers_group_price'];
	}
// EOF Separate Pricing Per Customer

	if (substr($specials_price, -1) == '%') {
	  $new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	  $new_special_insert = tep_db_fetch_array($new_special_insert_query);

	  $products_price = $new_special_insert['products_price'];
	  $specials_price = ($products_price - (($specials_price / 100) * $products_price));
	}

	$expires_date = '';
	if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
	  $expires_date = $year;
	  $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
	  $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
	}

	// BOF Separate Pricing Per Customer
/*		tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1')"); */
tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status, customers_group_id) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), '" . tep_db_input($expires_date) . "', '1', ".(int)$customers_group.")");
// EOF Separate Pricing Per Customer


	tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
	break;
  case 'update':
	$specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']);
	$products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']);
	$specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']);
	$day = tep_db_prepare_input($HTTP_POST_VARS['day']);
	$month = tep_db_prepare_input($HTTP_POST_VARS['month']);
	$year = tep_db_prepare_input($HTTP_POST_VARS['year']);

	if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price));

	$expires_date = '';
	if (tep_not_null($day) && tep_not_null($month) && tep_not_null($year)) {
	  $expires_date = $year;
	  $expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
	  $expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
	}

	tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = '" . tep_db_input($expires_date) . "' where specials_id = '" . (int)$specials_id . "'");

	tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id));
	break;
  case 'deleteconfirm':
	$specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']);

	tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'");

	tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page']));
	break;
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<?php
 if ( ($action == 'new') || ($action == 'edit') ) {
?>
<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
<?php
 }
?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<div id="popupcalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 if ( ($action == 'new') || ($action == 'edit') ) {
$form_action = 'insert';
if ( ($action == 'edit') && isset($HTTP_GET_VARS['sID']) ) {
  $form_action = 'update';

  // BOF Separate Pricing Per Customer
  $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date, s.customers_group_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");
// EOF Separate Pricing Per Customer

  $product = tep_db_fetch_array($product_query);

  $sInfo = new objectInfo($product);
} else {
  $sInfo = new objectInfo(array());

// create an array of products on special, which will be excluded from the pull down menu of products
// (when creating a new product on special)
  // BOF Separate Pricing Per Customer
/*	  $specials_array = array();
} */
$specials_array = array();
$specials_query = tep_db_query("select p.products_id, s.customers_group_id from " .  TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id");
while ($specials = tep_db_fetch_array($specials_query)) {
   $specials_array[] = (int)$specials['products_id'].":".(int)$specials['customers_group_id'];
}

if(isset($HTTP_GET_VARS['sID']) && $sInfo->customers_group_id!= '0'){
	$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $sInfo->products_id . "' and customers_group_id =  '" . $sInfo->customers_group_id . "'");
	  if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
		$sInfo->products_price = $customer_group_price['customers_group_price'];
	  }
}

  $specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = p.products_id");
  while ($specials = tep_db_fetch_array($specials_query)) {
	$specials_array[] = $specials['products_id'];
  }
}
?>
  <tr><form name="new_special" <?php echo 'action="' . tep_href_link(FILENAME_SPECIALS, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('specials_id', $HTTP_GET_VARS['sID']); ?>
	<td><br><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><?php echo TEXT_SPECIALS_PRODUCT; ?> </td>
		<td class="main"><?php echo (isset($sInfo->products_name)) ? $sInfo->products_name . ' <small>(' . $currencies->format($sInfo->products_price) . ')</small>' : tep_draw_products_pull_down('products_id', 'style="font-size:10px"', $specials_array); echo tep_draw_hidden_field('products_price', (isset($sInfo->products_price) ? $sInfo->products_price : '')); ?></td>
		</tr>
<!-- BOF Separate Pricing per Customer -->
	  <tr>
		<td class="main"><?php echo TEXT_SPECIALS_GROUPS; ?> </td>
		<td class="main"><?php if (isset($sInfo->customers_group_id)) {
		for ($x=0; $x<count($input_groups); $x++) {
		if ($input_groups[$x]['id'] == $sInfo->customers_group_id) {
		echo $input_groups[$x]['text'];
		}
		} // end for loop
		} else {
	 echo tep_draw_pull_down_menu('customers_group', $input_groups, (isset($sInfo->customers_group_id)?$sInfo->customers_group_id:''));
	 } ?> </td>
<!-- EOF Separate Pricing per Customer -->
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </td>
		<td class="main"><?php echo tep_draw_input_field('specials_price', (isset($sInfo->specials_new_products_price) ? $sInfo->specials_new_products_price : '')); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </td>
		<td class="main"><?php echo tep_draw_input_field('day', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($sInfo->expires_date) ? substr($sInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onMouseOver="calSwapImg('BTN_date', 'img_Date_OVER',true);" onMouseOut="calSwapImg('BTN_date', 'img_Date_UP',true);" onClick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><br><?php echo TEXT_SPECIALS_PRICE_TIP; ?></td>
		<td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). '   <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . (isset($HTTP_GET_VARS['sID']) ? '&sID=' . $HTTP_GET_VARS['sID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
	  </tr>
	</table></td>
  </form></tr>
<?php
 } else {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRODUCTS_PRICE; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
<?php
// BOF Separate Pricing Per Customer
/*	$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name"; */
$all_groups = array();
$customers_groups_query = tep_db_query("select customers_group_name, customers_group_id from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
while ($existing_groups =  tep_db_fetch_array($customers_groups_query)) {
  $all_groups[$existing_groups['customers_group_id']] = $existing_groups['customers_group_name'];
}

  $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.customers_group_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name";

  $customers_group_prices_query = tep_db_query("select s.products_id, s.customers_group_id, pg.customers_group_price from " . TABLE_SPECIALS . " s LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using (products_id, customers_group_id) ");

while ($_customers_group_prices = tep_db_fetch_array($customers_group_prices_query)) {
$customers_group_prices[] = $_customers_group_prices;
}
$specials_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows);
$specials_query = tep_db_query($specials_query_raw);
// BOF Separate Pricing Per Customer
$no_of_rows_in_specials = tep_db_num_rows($specials_query);
while ($specials = tep_db_fetch_array($specials_query)) {
for ($y = 0; $y < $no_of_rows_in_specials; $y++) {
if ( tep_not_null($customers_group_prices[$y]['customers_group_price']) && $customers_group_prices[$y]['products_id'] == $specials['products_id'] && $customers_group_prices[$y]['customers_group_id'] == $specials['customers_group_id']) {
$specials['products_price'] = $customers_group_prices[$y]['customers_group_price'];
} // end if (tep_not_null($customers_group_prices[$y]['customers_group_price'] etcetera
} // end for loop
// EOF Separate Pricing Per Customer
  if ((!isset($HTTP_GET_VARS['sID']) || (isset($HTTP_GET_VARS['sID']) && ($HTTP_GET_VARS['sID'] == $specials['specials_id']))) && !isset($sInfo)) {
	$products_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$specials['products_id'] . "'");
	$products = tep_db_fetch_array($products_query);
	$sInfo_array = array_merge($specials, $products);
	$sInfo = new objectInfo($sInfo_array);
  }

  if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) {
	echo '				  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '\'">' . "\n";
  } else {
	echo '				  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '\'">' . "\n";
  }
?>
			<td  class="dataTableContent"><?php echo $specials['products_name']; ?></td>
			<!-- BOF Separate Pricing Per Customer -->
			<td  class="dataTableContent" align="right"><span class="oldPrice"><?php echo $currencies->format($specials['products_price']); ?></span> <span class="specialPrice"><?php echo $currencies->format($specials['specials_new_products_price'])." (".$all_groups[$specials['customers_group_id']].")"; ?></span></td>
<!-- EOF Separate Pricing per Customer -->
			<td  class="dataTableContent" align="right">
<?php
  if ($specials['status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=0&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'action=setflag&flag=1&id=' . $specials['specials_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?></td>
			<td class="dataTableContent" align="right"><?php if (isset($sInfo) && is_object($sInfo) && ($specials['specials_id'] == $sInfo->specials_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials['specials_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
  </tr>
<?php
}
?>
		  <tr>
			<td colspan="4"><table border="0" width="100%" cellpadding="0"cellspacing="2">
			  <tr>
				<td class="smallText" valign="top"><?php echo $specials_split->display_count($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
				<td class="smallText" align="right"><?php echo $specials_split->display_links($specials_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
			  </tr>
<?php
 if (empty($action)) {
?>
			  <tr>
				<td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td>
			  </tr>
<?php
 }
?>
			</table></td>
		  </tr>
		</table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
case 'delete':
  $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SPECIALS . '</b>');

  $contents = array('form' => tep_draw_form('specials', FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm'));
  $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  $contents[] = array('text' => '<br><b>' . $sInfo->products_name . '</b>');
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
default:
  if (is_object($sInfo)) {
	$heading[] = array('text' => '<b>' . $sInfo->products_name . '</b>');

	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $sInfo->specials_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
	$contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($sInfo->specials_date_added));
	$contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($sInfo->specials_last_modified));
	$contents[] = array('align' => 'center', 'text' => '<br>' . tep_info_image($sInfo->products_image, $sInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
	$contents[] = array('text' => '<br>' . TEXT_INFO_ORIGINAL_PRICE . ' ' . $currencies->format($sInfo->products_price));
	$contents[] = array('text' => '' . TEXT_INFO_NEW_PRICE . ' ' . $currencies->format($sInfo->specials_new_products_price));
	$contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100)) . '%');

	$contents[] = array('text' => '<br>' . TEXT_INFO_EXPIRES_DATE . ' <b>' . tep_date_short($sInfo->expires_date) . '</b>');
	$contents[] = array('text' => '' . TEXT_INFO_STATUS_CHANGE . ' ' . tep_date_short($sInfo->date_status_change));
  }
  break;
 }
 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";
 }
}
?>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Cheers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...