Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Products Specifications


kymation

Recommended Posts

mumme: I don't understand how the file can not be found if it exists. Check the file location again. If it's really in the right place, I don't understand why it would not work.

 

Regards

Jim

 

I have checked several times, so that the locations is correct, but I also tried to load other files, with the same result.

 

So I did like this:

 

filenames.php add:

 

define('FILENAME_PRODUCTS_ACCESSORIES', 'products_accessories.php');

 

And in products_tab.php

 

change:

 

include_once( DIR_WS_MODULES . 'products_accessories.php' ) . "\n";

 

to:

 

include_once( DIR_WS_MODULES . FILENAME_PRODUCTS_ACCESSORIES) . "\n";

And I still get the same error,

 

BUT when I change it to:

 

include_once( DIR_WS_MODULES . FILENAME_PRODUCTS_ACCESSORIES);

 

It finds the file, but now I get a new error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'products_description pd where xp.products_id = '8' and xp.xsell_' at line 10
select distinct p.products_id, pd.products_name, pd.products_index_description, p.products_tax_class_id, p.products_price, p.products_iamge from products_xsell xp, products p products_description pd where xp.products_id = '8' and xp.xsell_product_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.sort_order asc limit 6

 

So to check if the x_selll module is working i changed:

 

include_once( DIR_WS_MODULES . FILENAME_PRODUCTS_ACCESSORIES);

 

to

 

include_once(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);

 

and now the X_sell is loaded in the tab, and I can see the products I assaigned as Xsell products.

 

 

 

Ps: when having:

include_once( DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS) . "\n";

It cant find the file, but when i remove ".\n" it finds it..

Edited by mumme
Link to comment
Share on other sites

There is probably something wrong with your install. Check your edits to the top part of admin/categories.php.

 

Regards

Jim

 

I have had a look in the admin/categories file and the does not seem to be any reference to getting the data from the different tabs before saving. i have pasted the code that i have below. it is the same file from the latest addon you posted. the only change i made was adding in the xsell addon

 

 

 

case 'update_product':

if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

$products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

 

$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

$sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

'products_date_available' => $products_date_available,

'products_weight' => (float)tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

'manufacturers_id' => (int)tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

 

$products_image = new upload('products_image');

$products_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_image->parse() && $products_image->save()) {

$sql_data_array['products_image'] = tep_db_prepare_input($products_image->filename);

}

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_date_added' => 'now()');

 

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

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

$products_id = tep_db_insert_id();

 

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

} elseif ($action == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

 

$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 . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$language_id = $languages[$i]['id'];

 

// Products Specifications

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

'products_description' => addslashes( tep_db_input( $_POST['products_description'][$language_id] ) ),

'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_id' => $products_id,

'language_id' => $language_id);

 

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

 

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_product') {

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

$pi_sort_order = 0;

$piArray = array(0);

 

foreach ($HTTP_POST_FILES as $key => $value) {

// Update existing large product images

if (preg_match('/^products_image_large_([0-9]+)$/', $key, $matches)) {

$pi_sort_order++;

 

$sql_data_array = array('htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_' . $matches[1]]),

'sort_order' => $pi_sort_order);

 

$t = new upload($key);

$t->set_destination(DIR_FS_CATALOG_IMAGES);

if ($t->parse() && $t->save()) {

$sql_data_array['image'] = tep_db_prepare_input($t->filename);

}

 

tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and id = '" . (int)$matches[1] . "'");

 

$piArray[] = (int)$matches[1];

} elseif (preg_match('/^products_image_large_new_([0-9]+)$/', $key, $matches)) {

// Insert new large product images

$sql_data_array = array('products_id' => (int)$products_id,

'htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_new_' . $matches[1]]));

 

$t = new upload($key);

$t->set_destination(DIR_FS_CATALOG_IMAGES);

if ($t->parse() && $t->save()) {

$pi_sort_order++;

 

$sql_data_array['image'] = tep_db_prepare_input($t->filename);

$sql_data_array['sort_order'] = $pi_sort_order;

 

tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array);

 

$piArray[] = tep_db_insert_id();

}

}

}

 

$product_images_query = tep_db_query("select image from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$products_id . "' and id not in (" . implode(',', $piArray) . ")");

if (tep_db_num_rows($product_images_query)) {

while ($product_images = tep_db_fetch_array($product_images_query)) {

$duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_IMAGES . " where image = '" . tep_db_input($product_images['image']) . "'");

$duplicate_image = tep_db_fetch_array($duplicate_image_query);

 

if ($duplicate_image['total'] < 2) {

if (file_exists(DIR_FS_CATALOG_IMAGES . $product_images['image'])) {

@unlink(DIR_FS_CATALOG_IMAGES . $product_images['image']);

}

}

}

 

tep_db_query("delete from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$products_id . "' and id not in (" . implode(',', $piArray) . ")");

}

 

// Start Products Specifications

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

// print 'Current Category ID: ' . $current_category_id; die;

$language_id = $languages[$i]['id'];

$specifications_query_raw = "

select

s.specifications_id

from " . TABLE_SPECIFICATION . " s

join " . TABLE_SPECIFICATIONS_TO_CATEGORIES . " sg2c

on (sg2c.specification_group_id = s.specification_group_id

and sg2c.categories_id = '" . (int) $current_category_id . "')

";

$specifications_query = tep_db_query ($specifications_query_raw);

 

$count_specificatons = tep_db_num_rows ($specifications_query);

if ($count_specificatons > 0) {

// print 'Specifications Exist!'; die;

while ($specifications = tep_db_fetch_array ($specifications_query) ) {

$specifications_id = (int) $specifications['specifications_id'];

 

tep_db_query ("delete from " . TABLE_PRODUCTS_SPECIFICATIONS . "

where products_id = '" . (int) $products_id . "'

and specifications_id = '" . $specifications_id . "'

and language_id = '" . $language_id . "'

");

 

$specification = $_POST['products_specification'][$specifications_id][$language_id];

if (is_array ($specification) ) {

foreach ($specification as $each_specification) {

$each_specification = tep_db_prepare_input ($each_specification);

if ($each_specification != '') {

$sql_data_array = array ('specification' => $each_specification,

'products_id' => $products_id,

'specifications_id' => $specifications_id,

'language_id' => $language_id

);

 

tep_db_perform (TABLE_PRODUCTS_SPECIFICATIONS, $sql_data_array);

} // if ($each_specification

} // foreach ($specification

 

} else {

$specification = tep_db_prepare_input ($specification);

if ($specification != '') {

$sql_data_array = array ('specification' => $specification,

'products_id' => $products_id,

'specifications_id' => $specifications_id,

'language_id' => $language_id

);

tep_db_perform (TABLE_PRODUCTS_SPECIFICATIONS, $sql_data_array);

} // if ($specification

} // if (is_array ... else ...

} // while ($specifications

} // if ($count_specificatons

} // for ($i=0

// End Products Specifications

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

// XSell

tep_reset_cache_block('xsell_products');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

break;

Link to comment
Share on other sites

I have checked several times, so that the locations is correct, but I also tried to load other files, with the same result. <snipped>

Yes, that's a bug. Two actually, since there is a comma missing from that SQL. I've updated it and will upload a new version as soon as I look at this other problem.

 

Thanks tor the help in finding my errors. I'm still amazed at all of the things that can go wrong with copying a working installation.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I have had a look in the admin/categories file and the does not seem to be any reference to getting the data from the different tabs before saving. <snipped>

Ouch, my poor eyes! That's completely unreadable. Please post code in a code block.

 

You're right; the generic tab code is missing. No idea how I managed to do that. I'll fix it and post a new release.

 

Thanks for the bug report, and for being persistent enough to make me go look.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Find somre more bugs.. :)

 

Im still on the accessories tab.

Made the updates to 1.10, and I get this error:

 

1054 - Unknown column 'pd.products_index_description' in 'field list'

 

So I changed

 

products_index_description
to
products_description

 

Then we get this error:

 

1054 - Unknown column 'p.products_iamge' in 'field list'

 

Thats just a Type error.. I changed

 

products_iamge
to
products_image

 

And then we get this error:

 

1054 - Unknown column 'xp.xsell_product_id' in 'on clause'

 

So i Changed

 

xp.xsell_product_id

to 

xp.xsell_id

 

Then we get this error:

 

Fatal error: Call to undefined function tep_get_category_name() in C:\wamp\www\hlm\includes\modules\products_accessories.php on line 55

 

And now Im stuck! =)

Link to comment
Share on other sites

One more try. I looked through the entire file and fixed everything I could find. Please let me know what I missed this time.

 

The file is available from my server until the poor overworked moderator approves the Addon. I'm starting to feel guilty about the server space all these releases are taking up.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Now its working! thumbsup.gif

 

Just some design issues left,

buts that is my problem to solve when I will finnish the design.. Thanks for the help!

Great contr. and very great support!

 

1.JPG

Link to comment
Share on other sites

I haven't tried to integrate Master Products with this on. It should certainly be possible. The modifications to products_info.php will be interesting.

 

To get the Add to Cart working, check that what you have added is inside the form tags. The Add to Cart form covered the whole page in the stock version, but it was considerably reduced for Products Specifications to make room for the forms in the tabs. Your Master Products additions need to go above the tabs, just before the </form> tag.

 

For the formatting issue in the Xsell tab, check the xsell addon. You may need to add the imageBox class to your stylesheet and format it there.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

Thanks for the bug fix. it is now saving the other tabs.

I am still having the strange \r\n characters being saved under the description when i use the CK editor.

The strange thing is all the other tabs save the data perfectly and reload it perfectly.

I noticed that you are adding slashes

 

products_description' => addslashes( tep_db_input( $_POST['products_description'][$language_id] ) ),

 

during the product update section you just fixed for us.

 

What is the reason for adding the slashes? please excuse my ignorance if this is a silly question.

 

I removed the "addslashes" section and is still does strange things to the "description" data

 

Any thoughts?

 

Regards

 

Bret

Link to comment
Share on other sites

Slashes are used to protect the database. Some special characters are not allowed in database fields as they would corrupt the data. addslashes() is used to escape the special characters so they will not damage your database.

 

The \r\n characters are a Windows thing, and probably something that ckeditor is doing as well. I haven't figured that one out yet, partly because it is difficult for me to test. The only machine that I have with Windows is a cranky, ancient XP box.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

For the Xsell formatting, here's the stylesheet class:

 

.imageBox {
 font-family: Verdana, Arial, sans-serif;
 font-size: 8pt;
 width: 12.5em;  /* Width of each Product Box */
 height: 15.75em;  /* Height of each Product Box */
 padding: 5px;  /* Padding between the Box contents and the border */
 border: 0px solid #182d5c;  /* Border around each Box -- modified by Javascript in the code */
 margin: 3px;  /* Margin between the Box border and other objects */
 background: #f9f9f9;  /* Background color of each Box */
 float: left;  /* Don't change this */
}

Make whatever changes you want to alter the style, but leave the last line alone. I'll add this to the stylesheet in the next release.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

I dont like to bother you with this, but I have tried to get Master Products and Products Specification to collaborate for several weeks now.

I usually solve most problem, but this was to difficult.. crying.gif

 

I can get the Master Products to work on the stock version without any problem, and I can also get Products Specification on the stock version without any problem.

This is the last thing I need to solve before this project is ready..

 

If you have time.. can you please check my product_info.php

(this is where I try to get Master products and Products Specification to collaborate)

 

<?php
/*
 $Id: product_info.php $
 $Loc: catalog/ $
 $Mod: Products Specifications 1.1 20110715 kymation $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 require('includes/application_top.php');
 require( DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO );
// Start Products Specifications
 require_once (DIR_WS_FUNCTIONS . 'products_specifications.php');
// Process data from the on-page forms
 require_once( DIR_WS_MODULES . 'product_info_process.php' );
// End Products Specifications
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
// Start Products Specifications
 if (SPECIFICATIONS_BOX_FRAME_STYLE == 'Tabs') {
   // Insert the javascript for the tabs
   $head_javascript = '  <script language="javascript" type="text/javascript">' . PHP_EOL;
   $head_javascript .= '    $(document).ready(function(){' . PHP_EOL;
   $head_javascript .= '	  initTabs();' . PHP_EOL;
   $head_javascript .= '    });' . PHP_EOL;
   $head_javascript .= '    function initTabs() {' . PHP_EOL;
   $head_javascript .= "	  $('#tabMenu a').bind('click',function(e) {" . PHP_EOL;
   $head_javascript .= '	  e.preventDefault();' . PHP_EOL;
   $head_javascript .= '	  var thref = $(this).attr("href").replace(/#/, "");' . PHP_EOL;
   $head_javascript .= "	  $('#tabMenu a').removeClass('active');" . PHP_EOL;
   $head_javascript .= "	  $(this).addClass('active');" . PHP_EOL;
   $head_javascript .= "	  $('#tabContent div.content').removeClass('active');" . PHP_EOL;
   $head_javascript .= "	  $('#'+thref).addClass('active');" . PHP_EOL;
   $head_javascript .= '	  });' . PHP_EOL;
   $head_javascript .= '    }' . PHP_EOL;
   $head_javascript .= '  </script>' . PHP_EOL;
   $head_javascript .= '  <script src="ext/jquery/star_rating/jquery.rating.pack.js" type="text/javascript" language="javascript"></script>' . PHP_EOL;
   $head_javascript .= '  <link href="ext/jquery/star_rating/jquery.rating.css" type="text/css" rel="stylesheet"/>' . PHP_EOL;
   $oscTemplate->addBlock( $head_javascript, 'header_tags' );
 }
 require( DIR_WS_INCLUDES . 'template_top.php' );

 // Master Products
 $master_status_query = tep_db_query("select products_id, products_master_status, products_master from " . TABLE_PRODUCTS . " where products_status = '1' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
 $master_check = tep_db_fetch_array($master_status_query);

// Master Products EOF

// echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
?>
<?php
 if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
 </div>
 <div style="float: right;">
   <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
</div>
<?php
 } else {
// Products Specifications
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price,  p.products_master_status, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, pd.products_tab_1, pd.products_tab_2, pd.products_tab_3, pd.products_tab_4, pd.products_tab_5, pd.products_tab_6 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
   $product_info = tep_db_fetch_array($product_info_query);
   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }
   if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
  $products_name = $product_info['products_name'];
   }
?>
<div>
 <h1 style="float: right;"><?php echo $products_price; ?></h1>
 <h1><?php echo $products_name; ?></h1>
</div>
<div class="contentContainer">
 <div class="contentText">
<?php
   if (tep_not_null($product_info['products_image'])) {
  $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
  if (tep_db_num_rows($pi_query) > 0) {
?>
   <div id="piGal" style="float: right;">
  <ul>
<?php
    $pi_counter = 0;
    while ($pi = tep_db_fetch_array($pi_query)) {
	  $pi_counter++;
	  $pi_entry = '	    <li><a href="';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '#piGalimg_' . $pi_counter;
	  } else {
	    $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']);
	  }
	  $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	  }
	  $pi_entry .= '</li>';
	  echo $pi_entry;
    }
?>
  </ul>
   </div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
 maxwidth: 300,
 maxheight: 200,
 thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
 thumbcontainer: 300,
 load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
  } else {
?>
   <div id="piGal" style="float: right;">
  <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
   </div>
<?php
  }
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
 cyclic: true
});
</script>
<?php
   }
?>
<?php //echo stripslashes($product_info['products_description']); ?> 
   <div style="clear: both;"></div>
<?php
if ($master_check['products_master_status'] > 0) {
   echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">';
 } else {
   echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
 }
?>
<?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
   <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
   <p>
<?php
  $products_id = ( int )$_GET['products_id'];
  $options_array = tep_get_products_attributes( $products_id, ( int )$languages_id, $product_info['products_tax_class_id'] );
  if( $options_array != false && is_array( $options_array ) && count ($options_array) > 0 ) {
    foreach( $options_array as $options ) {
	  echo tep_select_attributes( $products_id, $options, $languages_id, $product_info['products_tax_class_id'] );
    }
  }
?>
   </p>
<?php
   }
?>
 <br />

 <div style="clear: both;"></div>
 <br />
<?php
   include_once (DIR_WS_MODULES . FILENAME_PRODUCTS_TABS);
// End Products Specifications
?>
   <div style="clear: both;"></div>
<?php
   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
   <p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>
<?php
   }
?>
 </div>
<?php
   // Master Products
 if ($product_info['products_price']>0) {
   $qty_array = array();
   for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
    $qty_array[] = array('id' => $i, 'text' => $i);
   }
?>
   <p align="left" class="main">
<?php
   if ($product_info['products_quantity'] > 0)
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ;
 } elseif ((STOCK_CHECK == 'false') && ($product_info['products_quantity'] < 1)) {
   $qty_array = array();
   for ($i=0; $ns = 20, $i <= $ns; $i++) {
  $qty_array[] = array('id' => $i, 'text' => $i);
   }
   echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ;
 } else {
   echo TEXT_STOCK;
 }
?>
   </p>
<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and reviews_status = 1");
   $reviews = tep_db_fetch_array($reviews_query);
   $master_query = tep_db_query("select products_id, products_master from " . TABLE_PRODUCTS . " where products_status = '1' and products_master like '% " . $HTTP_GET_VARS['products_id'] . " %'"); //more masters like search between double "% products_id %" spaces
   $results = tep_db_fetch_array($master_query);
   if (($results['products_id'] != NULL) && ($product_info['products_master_status'] == 1)) { ?>
<div class="contentText">
   <p align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></p>
   <p><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></p>
</div>
<?php
   }
   //Slave product examination using $master_check
   //multiple masters have to use spaces between products_id and open and close tag "_"
   //for example: "_ 57 58 56 _"
   if (($master_check['products_id'] != NULL)) {
  //$rel = trim(preg_replace("/[_]/", "", $master_check['products_master'])); //alternate functions
  $rel = trim(str_replace('_', '', $master_check['products_master'])); //clean string
  $pos = strpos($rel, ' ');
  if ($pos !== false || $rel !== '0') {
?>
<div class="contentText">
   <p><?php include(DIR_WS_MODULES . FILENAME_SUGGESTED_MASTERS); ?></p>
</div>
<?php	
  }
   }
// Master Products EOF
?>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
   } else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
?>
</div>
<div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>

</div>
</form>

<?php
  if ($product_check['total'] >= 1) {
  include (DIR_WS_INCLUDES . 'products_next_previous.php');
  }
  ?>
<?php
 }
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

And this is the MASTER Products stock version of Product_info.php

Can you see where to insert the Products_specification codes?

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 require('includes/application_top.php');
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 require(DIR_WS_INCLUDES . 'template_top.php');
// Master Products
 $master_status_query = tep_db_query("select products_id, products_master_status, products_master from " . TABLE_PRODUCTS . " where products_status = '1' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$master_check = tep_db_fetch_array($master_status_query);
   if ($master_check['products_master_status'] > 0) {
  echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">';
   } else {
  echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
   }
// Master Products EOF
 if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
 </div>
 <div style="float: right;">
   <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
</div>
<?php
 } else {
//Master Products
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_master_status, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
//Master Products EOF
   $product_info = tep_db_fetch_array($product_info_query);
   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }
   if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
  $products_name = $product_info['products_name'];
   }
?>
<div>
 <h1 style="float: right;"><?php echo $products_price; ?></h1>
 <h1><?php echo $products_name; ?></h1>
</div>
<div class="contentContainer">
 <div class="contentText">
<?php
   if (tep_not_null($product_info['products_image'])) {
  $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
  if (tep_db_num_rows($pi_query) > 0) {
?>
   <div id="piGal" style="float: right;">
  <ul>
<?php
    $pi_counter = 0;
    while ($pi = tep_db_fetch_array($pi_query)) {
	  $pi_counter++;
	  $pi_entry = '	    <li><a href="';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '#piGalimg_' . $pi_counter;
	  } else {
	    $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']);
	  }
	  $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	  }
	  $pi_entry .= '</li>';
	  echo $pi_entry;
    }
?>
  </ul>
   </div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
 maxwidth: 300,
 maxheight: 200,
 thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
 thumbcontainer: 300,
 load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
  } else {
?>
   <div id="piGal" style="float: right;">
  <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
   </div>
<?php
  }
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
 cyclic: true
});
</script>
<?php
   }
?>
<?php echo stripslashes($product_info['products_description']); ?>
<?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
   <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
   <p>
<?php
  $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='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
    $products_options_array = array();
    $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
    while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
	    $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
    }
    if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
    } else {
	  $selected_attribute = false;
    }
?>
  <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
  }
?>
   </p>
<?php
   }
?>
   <div style="clear: both;"></div>
<?php
   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
   <p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>
<?php
   }
?>
 </div>
<?php
// Master Products
if ($product_info['products_price']>0) {
   $qty_array = array();
   for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
    $qty_array[] = array('id' => $i, 'text' => $i);
   }
?>
   <p align="left" class="main">
<?php
   if ($product_info['products_quantity'] > 0)
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ;
   } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
  $qty_array = array();
  for ($i=0; $ns = 20, $i <= $ns; $i++) {
    $qty_array[] = array('id' => $i, 'text' => $i);
  }
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) ;
   } else {
  echo TEXT_STOCK;
   }
?>
   </p>
<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and reviews_status = 1");
   $reviews = tep_db_fetch_array($reviews_query);
   $master_query = tep_db_query("select products_id, products_master from " . TABLE_PRODUCTS . " where products_status = '1' and products_master like '% " . $HTTP_GET_VARS['products_id'] . " %'"); //more masters like search between double "% products_id %" spaces
$results = tep_db_fetch_array($master_query);
if (($results['products_id'] != NULL) && ($product_info['products_master_status'] == 1)) { ?>
<div class="contentText">
   <p align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></p>
   <p><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></p>
</div>
<?php
}
   //Slave product examination using $master_check
   //multiple masters have to use spaces between products_id and open and close tag "_"
   //for example: "_ 57 58 56 _"
   if (($master_check['products_id'] != NULL)) {
  //$rel = trim(preg_replace("/[_]/", "", $master_check['products_master'])); //alternate functions
  $rel = trim(str_replace('_', '', $master_check['products_master'])); //clean string
  $pos = strpos($rel, ' ');
  if ($pos !== false || $rel !== '0') {
?>
<div class="contentText">
   <p><?php include(DIR_WS_MODULES . FILENAME_SUGGESTED_MASTERS); ?></p>
</div>
<?php	
  }
   }
// Master Products EOF
?>
 <div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
   <?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
 </div>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
   } else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
?>
</div>
</form>
<?php
 }
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

I understand if you dont have time, because this is beyond what you can expect on support for a contribution,

but I would really apperciate it!! innocent.gif

Link to comment
Share on other sites

Hi all,

 

trying to edit or change the headings above my drop down menus.. any ideas (see attached)

 

1. would like the heading text smaller

2. would like the drop down list menus slightly smaller and the inital text (--ALL--) smaller too (centered if possible).

3. would like to change the background colour or style of the drop down box.

 

 

Can anyon point me in the right direction...

 

 

also, if anyone has a nicer ajax or js solution that can be readily integrated I will give it a go!

 

cheers All!

 

 

see pic attached

Link to comment
Share on other sites

Hi Jim, I dont like to bother you with this, but I have tried to get Master Products and Products Specification to collaborate for several weeks now. <snip>

Sorry, but I really do not have the time to do this. I've been neglecting my work too much as it is.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi all, trying to edit or change the headings above my drop down menus.. <snip>

Install Firebug in Firefox. Right click on what you want to change and select Inspect Element. That will tell you the CSS element that you need to change.

 

Regards

JIm

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I think i have a sanitise or stripslash issue, only effecting the admin. See images attached.

 

1. i type the description in NEW PRODUCT / ADMIN - all i looks fine (html code)

example:

BATERIA LAVABO CAÑO CENTRAL GIRATORIO CON VÁLVULA AUTOMÁTICA <br><br><table width="100%" border="0"> <tr> <td style="border-bottom:solid #efefef 1px;border-top:solid #efefef 1px"><strong>Características</strong></td> <td style="border-bottom:solid #efefef 1px;border-top:solid #efefef 1px"><strong>Acabado</strong></td> <td style="border-bottom:solid #efefef 1px;border-top:solid #efefef 1px"><strong>Código</strong></td> </tr> <tr> <td>Montura cerámica</td> <td> LATÓN PULIDO</td> <td>LP12150/1</td> </tr> <tr> <td></td> <td>CROMO</td> <td>CR12150/1</td> </tr> <tr> <td></td> <td>PLATA</td> <td>PL12150/1</td> </tr> <tr> <td></td> <td>BRONCE VIEJO</td> <td>BV12150/1</td> </tr> <tr> <td></td> <td>BRONCE RÚSTICO</td> <td>BR12150/1</td> </tr> <tr> <td></td> <td>COBRE VIEJO</td> <td>CV12150/1</td> </tr> <tr> <td></td> <td>ORO</td> <td>OR12150</td> </tr> <tr> <td colspan="3"></td> </tr> <tr> <td>Montura convencional</td> <td>LATÓN PULIDO</td> <td>LP09150</td> </tr> <tr> <td></td> <td>CROMO</td> <td>CR09150/1</td> </tr> <tr> <td style="border-bottom:solid #efefef 1px;border-top:solid #efefef 1px"><strong>Tecnologías</strong></td> <td colspan="2" style="border-bottom:solid #efefef 1px;border-top:solid #efefef 1px"><img src="images/products/faucets/rovira/tecnologia2.jpg" width="40" height="60" /><img src="images/products/faucets/rovira/tecnologia9.jpg" alt="" width="40" height="60" /></td> </tr> </table>

 

2. Press SAVE - and look at the catalog: - looks great (result - image attached)

 

3. go back to the Admin and the description looks like this (after - image attached):

 

BATERIA LAVABO CAÑO CENTRAL GIRATORIO CON VÁLVULA AUTOMÁTICA <br><br><table width=\\\\\\\"100%\\\\\\\" border=\\\\\\\"0\\\\\\\"> <tr> <td style=\\\\\\\"border-bottom:solid #efefef 1px;border-top:solid #efefef 1px\\\\\\\"><strong>Características</strong></td> <td style=\\\\\\\"border-bottom:solid #efefef 1px;border-top:solid #efefef 1px\\\\\\\"><strong>Acabado</strong></td> <td style=\\\\\\\"border-bottom:solid #efefef 1px;border-top:solid #efefef 1px\\\\\\\"><strong>Código</strong></td> </tr> <tr> <td>Montura cerámica</td> <td> LATÓN PULIDO</td> <td>LP12150/1</td> </tr> <tr> <td></td> <td>CROMO</td> <td>CR12150/1</td> </tr> <tr> <td></td> <td>PLATA</td> <td>PL12150/1</td> </tr> <tr> <td></td> <td>BRONCE VIEJO</td> <td>BV12150/1</td> </tr> <tr> <td></td> <td>BRONCE RÚSTICO</td> <td>BR12150/1</td> </tr> <tr> <td></td> <td>COBRE VIEJO</td> <td>CV12150/1</td> </tr> <tr> <td></td> <td>ORO</td> <td>OR12150</td> </tr> <tr> <td colspan=\\\\\\\"3\\\\\\\"></td> </tr> <tr> <td>Montura convencional</td> <td>LATÓN PULIDO</td> <td>LP09150</td> </tr> <tr> <td></td> <td>CROMO</td> <td>CR09150/1</td> </tr> <tr> <td style=\\\\\\\"border-bottom:solid #efefef 1px;border-top:solid #efefef 1px\\\\\\\"><strong>Tecnologías</strong></td> <td colspan=\\\\\\\"2\\\\\\\" style=\\\\\\\"border-bottom:solid #efefef 1px;border-top:solid #efefef 1px\\\\\\\"><img src=\\\\\\\"images/products/faucets/rovira/tecnologia2.jpg\\\\\\\" width=\\\\\\\"40\\\\\\\" height=\\\\\\\"60\\\\\\\" /><img src=\\\\\\\"images/products/faucets/rovira/tecnologia9.jpg\\\\\\\" alt=\\\\\\\"\\\\\\\" width=\\\\\\\"40\\\\\\\" height=\\\\\\\"60\\\\\\\" /></td> </tr> </table>

 

 

CAN ANYONE HELP? - I have read all the posts - INCLUDES/FUNCTIONS/CLEAN-CODE... not sure if this is just an admin side issue

Link to comment
Share on other sites

Hello, hope this is the right place to ask for help.

 

I have installed the contribition, but when I get to installing the boxes module I get the following error:

 

PHP Fatal error: Call to undefined function tep_get_filter_sql() in D:\Domains\littlecreativedays.co.uk\wwwroot\catalog\includes\classes\specifications.php on line 107

 

 

 

 

I have checked that the catalog/includes/functions/products_specifications.php exists - and contains the function. Any ideas please?

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...