Jump to content

Recommended Posts

Hi,

 

Thank you for the lovely contribution. It works fine but I get the quotes when using the search option.

 

the quotes are listed together with the normal products. how do I get around this problem?

 

NN

Share this post


Link to post
Share on other sites

the quotes are listed together with the normal products. how do I get around this problem?

See the previous page for changes that fix problems like that.

Share this post


Link to post
Share on other sites

Hey Jack, nice piece of software. I have a site that is selling simple stuff to customers on the back of consultancy they commision us to do. I wondered if I could serve customer specific reports that have been generated for them with your quotes system, when they login? Instead of a quotation, could I provide a report that only that customer could see or download in .pdf? Or can you refer me somewhere else if not? Thanks.

Share this post


Link to post
Share on other sites

No, this isn't setup to work that way. The quotes are specific to the customer though so each is the only one to see it. But the quotes are added as products and that is not what you are looking for.

Share this post


Link to post
Share on other sites

Hi Jack,

 

well got round to installing this module tonight and thought things were going rather well, however when I load the quote in admin I dont have the details of the quote that show on the admin/quotes.php.

 

Is that how its supposed to work or is the something i have missed.

 

I can post my files if needed, but my site is very heavily modified I am surprised I got this to work at all first time as well as it does.

 

ie., can create the quote catalog side, see it in the quotes and edit it and see the amdended quote in catalog.

I will do more testing tomorrow to see if it does work properly and i havent broken anything else in the store.

 

Great module as always Jack

 

Thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Thank you. :) When you add the quote from the quotes section in admin, it should open a new product page and enter in a few things, like the email address. But it won't fill in any of the product details since those can be entered in free form in the quote and there's no way to extract that. I plan a change where the product data is saved in the quote so the product quote can be filled in using that but don't know when that will be.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

when I use an attribute I get the attribute code {1}503, can this be dispalyed as the actual attribute value sky blie pink with yelow dots instead of the the number?

Thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

The code uses the oscommerce code for getting the cart contents, which just returns the numbers. That will have to be changed to replace the attribute name for its number. It can be done but is not a quick change. I'll add it to the list for changes in a future version.

Share this post


Link to post
Share on other sites

The code uses the oscommerce code for getting the cart contents, which just returns the numbers. That will have to be changed to replace the attribute name for its number. It can be done but is not a quick change. I'll add it to the list for changes in a future version.

 

cool, its a great mod and appears to be working seemlessly, I have been having a look at the shopping cart to try and work out how to do this but not sure, do you have any tips how I should approach it, if I get a solution I will post it, its knowing what to look at first.

 

thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

the quote expiry date is stored in the products table, it would be useful if in the quotes page it displayed the quote expiry date.

 

I have done that with the code below, but maybe it be better to have, 'Expires In' then the number of days left before the quote expires being displayed as nDays, and maybe make it change colour to red if there is less than a week left on the quote. I will be looking at doing that in the near future.

 

in languages/english.php

added define('TEXT_QUOTES_DATE_EXPIRE', 'Expiry Date');

 

in quotes.php

 

added

 <th class="quotesBoxHeading"><?php echo TEXT_QUOTES_DATE_EXPIRE; ?></th>

before

<th class="quotesBoxHeading"><?php echo TEXT_QUOTES_STATUS; ?></th>

added

<td class="quotesLink" align="center"><?php echo tep_date_only($product_check['quotes_expire']); ?> </td>[/code] after

<td class="quotesLink" align="center"><?php echo tep_date_only($product_check['products_date_added']); ?>  </td>


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Jack.

 

This is an awesome module - I really do dig it. I have trawled this forum for the last few hours and did my best to try and solve the small issue I am having.

In a nutshell I have a module called 'main_cats' that allows me to display the root categories in the main box of my main page. I have made all the changes to all the ohter files I have been instructed to in this forum but still cannot seem to have the Quotes category do its magic disapearing trick from that box. Now I believe i ahve narrowed it down to making a similar entry like the ones aforementioned into 'main_cats'. I tried a few variations etc but to no avail. this is the current code of 'main_cats'

 

<?php
/*
$Id: main_cats.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/
?>
<!-- main_categories - EM-STUDIO.info//-->
<?php

$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_HEADING_CATEGORIES
);
new contentBoxHeading($info_box_contents);
echo tep_draw_separator('pixel_trans.gif', '100%', '6');

$row = 0;
$col = 0;
$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
$info_box_contents = array();
$result = tep_db_query("SELECT * FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.parent_id = '0' AND c.categories_id = cd.categories_id AND cd.language_id = '" . (int)$languages_id . "' ORDER BY sort_order ");

while($data = tep_db_fetch_array($result)){
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="' . $width . '" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_path($data['categories_id'])) . '">' . tep_image(DIR_WS_IMAGES . $data['categories_image'], $data['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $data['categories_name']);

$col ++;
if ($col == MAX_DISPLAY_CATEGORIES_PER_ROW) {
$col = 0;
$row ++;
}
}
new contentBox($info_box_contents);
?>
<!-- main_categories_eof //-->

 

My instinct is telling me that inserting 'AND quotes_email NOT LIKE etc etc' in the $result line is somewhere close to the mark, but i have exhausted all my avenues short of this post.

 

Thanks Jack you legend. I am not good enuff to write cool code like you but if you need some photoshop work done do not hesitate to message me through thr forum.

Share this post


Link to post
Share on other sites

That code looks similar to the new products module which is included in the contribution. You should be able to compare them to find the needed changes.

Share this post


Link to post
Share on other sites

That code looks similar to the new products module which is included in the contribution. You should be able to compare them to find the needed changes.

 

Jack - I had already tried that solution using Above Compare program to seek out the differnces and insert the right code. I went back and tried my best to get it going but it would keep returing error. Re-Scoured the forum tried and failed again, spent the better part of 8 hours yesterday trying to get this last piece of code sorted.

 

 

 

If possible could You, or someone please paste the correct line of code in this thread. It kind of feels defeatest asking for that, but i need to go live with my site very soon and this is one of the last niggling issues I have. Not one to be an all take and no give kinda guy (and unfortunaltey I can't give in the form of OSC contributions)in anticipation of a correct response from any of the lovely people on these boards, I will 'contribute' 2 concepts that have helped me greatly in life.

 

1. The key to happiness is feeling useful.

2. The meaning of life is meaningful relationships, without them your life has no meaning.

 

Thank You OSC Community

Share this post


Link to post
Share on other sites

Jack - I had already tried that solution using Above Compare program to seek out the differnces and insert the right code. I went back and tried my best to get it going but it would keep returing error. Re-Scoured the forum tried and failed again, spent the better part of 8 hours yesterday trying to get this last piece of code sorted.

 

 

 

If possible could You, or someone please paste the correct line of code in this thread. It kind of feels defeatest asking for that, but i need to go live with my site very soon and this is one of the last niggling issues I have. Not one to be an all take and no give kinda guy (and unfortunaltey I can't give in the form of OSC contributions)in anticipation of a correct response from any of the lovely people on these boards, I will 'contribute' 2 concepts that have helped me greatly in life.

 

1. The key to happiness is feeling useful.

2. The meaning of life is meaningful relationships, without them your life has no meaning.

 

Thank You OSC Community

 

I am finding more similarities in product_info than new products. I am enetering day 3 of trying to solve this line of code. I know you are probably sitting there reading this going - 'jeesh another idiot who can't code simple old php, and i already pointed him in the right direction, and the rest of the forum surely explains what he needs to know' - Not an idiot, just not a coder, Not lazy, just not a coder, Not a selfish fool, I have offered what I can in exchange (and hey if the infinite wisdom of the Dali Lama and the Cosmos isn't a fair swap, no problems, ask me for money)

 

I just want this issue solved, and would like to use your excellent module on our site as it does really go hand in hand with package deals and the more expensive products we supply.

Share this post


Link to post
Share on other sites

You are asking for coding help with something specific to your shop and that isn't something I offer in the forums. Otherwise I would be swapmped with such requests.

Share this post


Link to post
Share on other sites

You are asking for coding help with something specific to your shop and that isn't something I offer in the forums. Otherwise I would be swapmped with such requests.

 

If you feel this is beyond free support for your module, I am more than happy to pay for the answer to my question.

Share this post


Link to post
Share on other sites

If you feel this is beyond free support for your module, I am more than happy to pay for the answer to my question.

I've sent a PM.

Share this post


Link to post
Share on other sites

You are asking for coding help with something specific to your shop and that isn't something I offer in the forums. Otherwise I would be swapmped with such requests.

 

 

Hi Jack,

 

hows things?

 

This quotes module, requires a few changes, basically anywhere that reproduces the category list?

 

So, that would include site maps both google and sitemap seo

 

also if i am not logged in but type in the quotes url i can retrive the quote data, have I missed something in the installation?

 

Thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Hi Jack,

 

hows things?

 

This quotes module, requires a few changes, basically anywhere that reproduces the category list?

 

So, that would include site maps both google and sitemap seo

 

also if i am not logged in but type in the quotes url i can retrive the quote data, have I missed something in the installation?

 

Thanks

 

 

As far as i can see I have category/ies queries in index.php and that maybe why I can still access the quotes page directly with the products showing in the category. I have gone through the thread and corrected my seo, best sellers etc but couldnt find anything on this.

 

Thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

As far as i can see I have category/ies queries in index.php and that maybe why I can still access the quotes page directly with the products showing in the category. I have gone through the thread and corrected my seo, best sellers etc but couldnt find anything on this.

 

Thanks

Did you make sure all of the edits previously mentioned in this thread have been applied?

Share this post


Link to post
Share on other sites

Did you make sure all of the edits previously mentioned in this thread have been applied?

Hi Jack I went through them all yesterday/ this morning, and I could still get to the quotes-c-1.html (quotes category is category 1)

, the other mods dont display the category, but the index.php has some code in it regardinf categories and this appears untouched, as far as I can tell the its the header tags mod that has the code that needs changing, I had ago my self but when I selected a category the site went to a blank page so I obviously didnt code it correctly.

 

Thanks

 

Wayne

Edited by johnnybebad

Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Are you saying you can see the quotes category or the actual quotes. If the latter, which I assumed, what page are you going to to see it?

Share this post


Link to post
Share on other sites

Are you saying you can see the quotes category or the actual quotes. If the latter, which I assumed, what page are you going to to see it?

 

 

I am regoing through all this again to make sure, but as it stands i can see the quotes category and the quotes in it, when I visit the page directly


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

I am regoing through all this again to make sure, but as it stands i can see the quotes category and the quotes in it, when I visit the page directly

 

 

Okay i have found the problem its the product listing mod I think, as this list the products in the given categories in one of two ways but I think the queries that need changing are in the one file:-

 

modules/product_listing.php I am looking through this but its not jumping out at me so feel free to jump in.

 

Hers the code:-

 

<?php
/*
original: $Id: product_listing.php,v 1.44 2003/06/09 22:49:43 hpdl Exp $

corrected for proper HTML 2005/07/10 JanZ
merged and updated by djmonkey1 with indispensable assistance by JanZ 2005/10/05
v2.1 developed by djmonkey1 with indispensable assistance by the Mighty JanZ  2005/10/09
reverted to  a non-SPPC state by djmonkey1
v 2.2 modified by adilovetini with small feature 2006/04/18
v 2.2.5 bugfix for "Continue shopping" button bug 2008/02/17 JanZ
adapted for Separate Pricing Per Customer v4.2.1 2008/03/16

osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

*/

//version 2.2 modification
//if number of column per row is 1, include the original product_listing.php
if (PRODUCT_LIST_NUMCOL == 1) {
include(dirname(__FILE__).'/product_listing.php');

} else {
//display the version 2.2 product_listing_col.php code

//bof product listing with attributes
$list_box_contents = array();
$list_box_contents[] = array('params' => 'class="productListing-heading"');
$cur_row = sizeof($list_box_contents) - 1;

// three variables that determine a certain output
$use_tr_for_buy_now_button = false;
$add_multiple = false;
$use_of_attributes = false;

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {

	case 'PRODUCT_LIST_MULTIPLE':
		$add_multiple = true;
     $use_of_attributes = true;
		echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'products_id')) . 'action=add_multiple', 'NONSSL') . '">';
		break;

	case 'PRODUCT_LIST_BUY_NOW_MULTIPLE':
     $use_of_attributes = true;
		break;

   case 'PRODUCT_LIST_BUY_NOW':
     $use_tr_for_buy_now_button = true;
     break;
}
}
//eof product listing with attributes
?>
<?php
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>  <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

 <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y', 'products_id'))); ?></td>
</tr>
</table>
<?php
}

$list_box_contents = array();
global $cart;

if ($listing_split->number_of_rows > 0) {

//BOF version 2.2 modification
if (PRODUCT_LIST_NUMCOL <= 0) {
	$colnum = 3;
	$tdsize = floor(100/3);
} else {
	$colnum = PRODUCT_LIST_NUMCOL;
	$tdsize = floor(100/PRODUCT_LIST_NUMCOL);
}
//EOF version 2.2 modification

$row = 0;
$column = 0;
$listing_query = tep_db_query($listing_split->sql_query);
// BOF Separate Pricing per Customer
  $no_of_listings = tep_db_num_rows($listing_query);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
 $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
  $customer_group_id = '0';
 }

 while ($_listing = tep_db_fetch_array($listing_query)) {
   $_listing['total'] = ''; // for number of attributes
   $listing[] = $_listing;
   $list_of_prdct_ids[] = $_listing['products_id'];
 }

// lets save all the separate count queries that check if a product has attributes
// and do it in one (if needed)
 if ($use_of_attributes == true) {
   $products_attributes_count_query = tep_db_query("select count(*) as total, patrib.products_id from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id in (" . implode(',', $list_of_prdct_ids) . ") and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' and find_in_set('" . $customer_group_id . "', attributes_hide_from_groups) = 0 group by products_id");
	while ($_products_attributes_count = tep_db_fetch_array($products_attributes_count_query)) {
     $products_attributes_count[] = array('products_id' => $_products_attributes_count['products_id'], 'total' => $_products_attributes_count['total']);
   }
   $no_of_products_with_attributes = count($products_attributes_count);
   for ($x = 0; $x < $no_of_listings; $x++) {
     if (!empty($products_attributes_count)) {
       for ($i = 0; $i < $no_of_products_with_attributes; $i++) {
         if ($listing[$x]['products_id'] == $products_attributes_count[$i]['products_id'] ) {
           $listing[$x]['total'] = $products_attributes_count[$i]['total'];
         }
       }
     }
   } // end for ($x = 0; $x < $no_of_listings; $x++)
 } // end ($use_of_attributes == true)

// get all product prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id in (" . implode(',', $list_of_prdct_ids) . ") and pg.customers_group_id = '".$customer_group_id."' ");

 while ($pg_array = tep_db_fetch_array($pg_query)) {
   $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);
 }

 for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
   if (!empty($new_prices)) {
     for ($i = 0; $i < count($new_prices); $i++) {
       if ($listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
         $listing[$x]['products_price'] = $new_prices[$i]['products_price'];
         $listing[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
         $listing[$x]['final_price'] = $new_prices[$i]['final_price'];
       }
     }
   } // end if(!empty($new_prices)
 $listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group
 $listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price
 } // end for ($x = 0; $x < $no_of_listings; $x++)
} // end if ($customer_group_id != '0')
// an extra query is needed for all the specials

 $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") and status = '1' and customers_group_id = '" . $customer_group_id . "'");
 while ($specials_array = tep_db_fetch_array($specials_query)) {
   $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);
 }

// add the correct specials_new_products_price and replace final_price
 for ($x = 0; $x < $no_of_listings; $x++) {
   if (!empty($new_s_prices)) {
     for ($i = 0; $i < count($new_s_prices); $i++) {
       if ($listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
         $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
         $listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];
       }
     }
   } // end if (!empty($new_s_prices)
 } // end for ($x = 0; $x < $no_of_listings; $x++)

 $counter = 0;
 $class_for_buy_now = 'class="productListing-data" width="' . $tdsize . '%"';
 for ($x = 0; $x < $no_of_listings; $x++) {

  if ($x % PRODUCT_LIST_NUMCOL == 0) { // start of new row
    if (($counter+1)/2 == floor(($counter+1)/2)) { // start with the background color productListing-odd
// if ($counter/2 == floor($counter/2)) { // if you want to start with the background color productListing-even use this
      $list_box_contents[$row] = array('params' => 'class="productListing-even"');
      $class_for_buy_now_row = 'class="productListing-even"';
    } else {
      $list_box_contents[$row] = array('params' => 'class="productListing-odd"');
      $class_for_buy_now_row = 'class="productListing-odd"';
    }
  } // end if ($x % PRODUCT_LIST_NUMCOL == 0)

	$product_contents = array();
	for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
		$lc_align = '';

		switch ($column_list[$col]) {

			case 'PRODUCT_LIST_MODEL':
			$lc_align = '';
			$lc_text = ' ' . $listing[$x]['products_model'] . ' ';
			break;

			case 'PRODUCT_LIST_NAME':
			$lc_align = '';
			if (isset($_GET['manufacturers_id'])) {
				$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . (int)$_GET['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
			} else {
				$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';
			}
			break;

			case 'PRODUCT_LIST_MANUFACTURER':
			$lc_align = '';
			$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';
			break;

			case 'PRODUCT_LIST_PRICE':
			$lc_align = 'right';
			if (tep_not_null($listing[$x]['specials_new_products_price'])) {
				$lc_text = ' <s>' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
			} else {
				$lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';
			}
			break;

			case 'PRODUCT_LIST_QUANTITY':
			$lc_align = 'right';
			$lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';
			break;

			case 'PRODUCT_LIST_WEIGHT':
			$lc_align = 'right';
			$lc_text = ' ' . $listing[$x]['products_weight'] . ' ';
			break;

			case 'PRODUCT_LIST_IMAGE':
			$lc_align = 'center';
			if (isset($_GET['manufacturers_id'])) {
				$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . (int)$_GET['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
			} else {
				$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
			}
			break;
			//bof product listing with attributes
			case 'PRODUCT_LIST_BUY_NOW':
       // this button will be in a separate table row for better aligning
      $buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort', 'products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> ';
      $lc_text = ''; // otherwise the previous $lc_text will be outputted again 
			break;

			// Begin Buy Now button with attributes and quantity mod 
			// Begin Add Multiple  with attributes Contrib
			case 'PRODUCT_LIST_MULTIPLE': 
			$lc_align = 'right'; 
			$lc_valign = 'top'; 
			$lc_text = (TABLE_HEADING_MULTIPLE . tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '0', 'size="4"'));
       if ((int)$listing[$x]['total'] > 0) {
				$lc_text .= '<table border="0" cellpadding="0" cellspacing"0">';
				$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
				while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
					$selected_attribute = false;
					$products_options_array = array();
					$lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n";
					$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
 		$products_options = array(); // makes sure this array is empty again
       while ($_products_options = tep_db_fetch_array($products_options_query)) {
	      $products_options[] = $_products_options;
	      $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
      }

   if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
     $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
    $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
    while ($pag_array = tep_db_fetch_array($pag_query)) {
	    $cg_attr_prices[] = $pag_array;
    }

 // substitute options_values_price and prefix for those for the customer group (if available)
  if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($z = 0 ; $z < count($products_options); $z++) {
	    for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		    if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$z]['products_attributes_id']) {
			    $products_options[$z]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			    $products_options[$z]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		    }
	    } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
    }
   } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
   } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

  for ($v = 0 ; $v < count($products_options); $v++) {
         $options_text = ''; // make it empty again
         $options_text = $products_options[$v]['products_options_values_name'];
         if (defined('PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN') && PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN == 'Yes') {
          // if ((int) $products_options[$v]['options_values_price'] != '0') {
             if (tep_not_null($listing[$x]['specials_new_products_price'])) {
               $original_price = $listing[$x]['specials_new_products_price'];
             } else {
               $original_price = $listing[$x]['products_price'];
             }
             if ($products_options[$v]['price_prefix'] == "-") // in case price lowers, don't add values, subtract 
             {
	            $show_price = 0.0 + $original_price - $products_options[$v]['options_values_price']; // force float (in case) using the 0.0;
            } else {
       	      $show_price = 0.0 + $original_price + $products_options[$v]['options_values_price']; // force float (in case) using the 0.0;
            }
             $options_text .= ' (' .  $currencies->display_price($show_price, tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') ';
        // }
         } else {
           if ($products_options[$v]['options_values_price'] != '0') {
             $options_text .= ' (' . $products_options[$v]['price_prefix'] . $currencies->display_price($products_options[$v]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') ';
           } 
         }
         $products_options_array[] = array('id' => $products_options[$v]['products_options_values_id'], 'text' => $options_text);
       }  // end for ($v = 0 ; $v < count($products_options); $v++)
// EOF SPPC attributes mod
					$lc_text .= tep_draw_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);
					$lc_text .= '</td></tr>';
				}
				$lc_text .= '</table>';
			}
			break;	

			case 'PRODUCT_LIST_BUY_NOW_MULTIPLE': 
			$lc_align = 'right'; 
			$lc_valign = 'top'; 
			$lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort', 'products_id')) . 'action=buy_now_form', 'NONSSL') . '">';
			$lc_text .= (TABLE_HEADING_MULTIPLE) . '<input type="text" name="cart_quantity" value="1" maxlength="6" size="4">'; 
       if ((int)$listing[$x]['total'] > 0) {
				$lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; 
				$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); 
				while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { 
					$selected_attribute = false; 
					$products_options_array = array();
					$lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n";
					$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
 		$products_options = array(); // makes sure this array is empty again
       while ($_products_options = tep_db_fetch_array($products_options_query)) {
	      $products_options[] = $_products_options;
	      $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
      }

   if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
     $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
    $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
    while ($pag_array = tep_db_fetch_array($pag_query)) {
	    $cg_attr_prices[] = $pag_array;
    }

 // substitute options_values_price and prefix for those for the customer group (if available)
  if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($z = 0 ; $z < count($products_options); $z++) {
	    for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		    if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$z]['products_attributes_id']) {
			    $products_options[$z]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			    $products_options[$z]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		    }
	    } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
    }
   } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
   } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

  for ($v = 0 ; $v < count($products_options); $v++) {
         $options_text = ''; // make it empty again
         $options_text = $products_options[$v]['products_options_values_name'];
         if (defined('PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN') && PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN == 'Yes') {
          // if ((int) $products_options[$v]['options_values_price'] != '0') {
             if (tep_not_null($listing[$x]['specials_new_products_price'])) {
               $original_price = $listing[$x]['specials_new_products_price'];
             } else {
               $original_price = $listing[$x]['products_price'];
             }
             if ($products_options[$v]['price_prefix'] == "-") // in case price lowers, don't add values, subtract 
             {
	            $show_price = 0.0 + $original_price - $products_options[$v]['options_values_price']; // force float (in case) using the 0.0;
            } else {
       	      $show_price = 0.0 + $original_price + $products_options[$v]['options_values_price']; // force float (in case) using the 0.0;
            }
             $options_text .= ' (' .  $currencies->display_price($show_price, tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') ';
        // }
         } else {
           if ($products_options[$v]['options_values_price'] != '0') {
             $options_text .= ' (' . $products_options[$v]['price_prefix'] . $currencies->display_price($products_options[$v]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') ';
           } 
         }
         $products_options_array[] = array('id' => $products_options[$v]['products_options_values_id'], 'text' => $options_text);
       }  // end for ($v = 0 ; $v < count($products_options); $v++)
// EOF SPPC attributes mod
					$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); 
					$lc_text .= '</td></tr>'; 
				} 
				$lc_text .= '</table>'; 
				$lc_text .= tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW);

			} // end if ((int)$listing[$x]['total'] > 0)
			if ((int)$listing[$x]['total'] == 0) { 
				$lc_text .= '<br> ';
				$lc_text .= tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW);
				$lc_text .= '<br> ';
				$lc_text .= '<table border="0" cellpadding="0" cellspacing"0"><tr><td class="main"></td><td></td></tr></table>';
			}
			$lc_text .= '</form>'; 
			break; 

			// End Add Multiple mod

		}
		$product_contents[] = $lc_text;
	}
	$lc_text = implode('<br>', $product_contents);
	$list_box_contents[$row][$column] = array('align' => 'center',
											//bof product listing with attributes
											'valign' => $lc_valign,
											//eof product listing with attributes
											//2.2 modification ,add width in td
                                             'params' => 'class="productListing-data" width="'.$tdsize.'%"',
                                             'text'  => $lc_text);


	$column ++;

	if ($x == ($no_of_listings -1)) {
		$last_column = ($x % PRODUCT_LIST_NUMCOL); // x modulus number of columns
		//BOF version 2.2 modification
		// fill up the remainder of the table row with empty cells
		for ($column = ($last_column + 1) ; $column < $colnum; $column++) {
			$list_box_contents[$row][$column] = array('align' => 'center',
											//bof product listing with attributes
											'valign' => $lc_valign,
											//eof product listing with attributes
											//2.2 modification ,add width in td
                                             'params' => 'class="productListing-data" width="'.$tdsize.'%"',
                                             'text'  => " ");
		}
	} 

	if ($column >= $colnum && $x < ($no_of_listings -1)) {
		$row ++; // we start a new tr here  with $list_box_contents unless we already listed all products
		// $list_box_contents[$row] = array('params' => $class_for_buy_now);
		$column = 0;
     $counter++; // counter only goes up after the buy now buttons have been outputted, counts the real rows
     if ($use_tr_for_buy_now_button == true) {
     // make sure all data cells per row are filled
     $last_column = sizeof($buy_now_button_array);
     for ($zz = $last_column ; $zz < PRODUCT_LIST_NUMCOL; $zz++) {
       $buy_now_button_array[] = " ";
     }
     $list_box_contents[$row] = array('params' => $class_for_buy_now_row);
     foreach ($buy_now_button_array as $column1 => $lc_text1) {
       $list_box_contents[$row][$column1] = array('align' => 'center',

                                              'params' => 'class="productListing-data"',
                                              'text'  => $lc_text1);

     }
    unset($buy_now_button_array);
    $row ++;
     } // end if ($use_tr_for_buy_now_button == true)
   // output the last row with buy now buttons if needed
	} elseif ($x == ($no_of_listings -1) && $use_tr_for_buy_now_button == true) { 
		$row ++; // we start a new tr here with $list_box_contents for the last row with buy now buttons
     // make sure all data cells per row are filled
     $last_column = sizeof($buy_now_button_array);
     for ($zz = $last_column ; $zz < PRODUCT_LIST_NUMCOL; $zz++) {
       $buy_now_button_array[] = " ";
     }
     $list_box_contents[$row] = array('params' => $class_for_buy_now_row);
     foreach ($buy_now_button_array as $column1 => $lc_text1) {
       $list_box_contents[$row][$column1] = array('align' => 'center',
                                              'params' => 'class="' . $class_for_buy_now . '"',
                              %20            'text' => TEXT_NO_PRODUCTS);



new productListingBox($list_box_contents);
}

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
 <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
 <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'R0            'text' => TEXT_NO_PRODUCTS);



new productListingBox($list_box_contents);
}

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
 <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
 <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y', 'products_id'))); ?></td>
</tr>
<?php if ($add_multiple == true){
?>
 <tr> 
   <td align="left" class="main"> </td>
   <td align="right" class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); // added end of form here 
   ?></form></td> 
 </tr> 
<?php } ?>
</table>
<?php
 }
}
?>

Edited by johnnybebad

Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×