Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need a little code help combing 2 contribs


panthercoug

Recommended Posts

Hello,

I have recently installed add on Ultimate Images Pack (this works fine). now I am trying to install add on Extra Product Fields, on the catalog/product_info.php page it says to look for the folling original code

 

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

 

and to replace it with this code

 

// begin Product Extra Fields
   $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_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id";
   foreach ($epf as $e) {
     $query .= ", pd." . $e['field'];
   }
   $query .= " 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_query = tep_db_query($query);
   // end Product Extra Fields

 

My problem is my original code was already edited by the images pack and now looks like this

 

// BOF MaxiDVD: Modified For Ultimate Images Pack!
$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, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, 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 . "'");
// EOF MaxiDVD: Modified For Ultimate Images Pack!

 

I am no code master by any means lol I can bearly do enough to get me by, What changes would I have to make to make these 2 codes work tegether? I tryed just adding the p.products_image_med, p.products_image_lrg...etc to the new code but this gives me a error on the page. Any help would be greatly appreciated?

Link to comment
Share on other sites

Mark,

 

Can you link to the actual contributions you installed and which versions. We would need to see the code to make suggestions. What you have provided isn't giving me much to work with.

 

 

 

 

Chris

Link to comment
Share on other sites

Perhaps you made a mistake in where or how you added the extra image fields to the query?

 

I can't see why this wouldn't work:

 

// begin Product Extra Fields
   $query = "select 
p.products_id,pd.products_name, pd.products_description, p.products_model,p.products_quantity, p.products_image, 
p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id";
   foreach ($epf as $e) {
     $query .= ", pd." . $e['field'];
   }
   $query .= " 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_query = tep_db_query($query);
   // end Product Extra Fields

 

Of course, modifying that particular query isn't the only thing that would need to be done and you would have to be sure any error message was refering to the query.

Edited by Ben Nevis

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Link to comment
Share on other sites

Dunweb,

The pickure pack I used was http://addons.oscommerce.com/info/1642 and the product fields addon is http://addons.oscommerce.com/info/6856

 

Ben Nevis,

That is how I tryed the code, and it was also giving me the same error for the same type of code on another page that used this same line. Figured if I find the problem here it will be the same problem there lol. and the error was pointing to this first line.

$query = "select p.products_id, pd.products_name, ETC

Link to comment
Share on other sites

Ok, well tell us the full error message you got and copy the exact code of the relevant lines from your file into your message.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

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