Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Optional Related Products, Version 4.0


Skittles

Recommended Posts

hi Skittles ! compliments for this great contrie

this is one of the best development contries i have seen here

 

i have just one small question to optimize the views

don´t know where can i fix the link and the space near the price

 

here as

 

my normal product listing view

 

right.jpg

and that´s yours related products listing view

 

wrong.jpg

so i´d like to delete the link at price

and create the space behind the price

thank you :thumbsup:

Hi truelovestore_en.

 

What a busy week this has been, between the holiday weekend, and (finally) getting my osc cart live on my photography site! Somewhere in all the chaos, I missed the notification there was post on this thread. My apologies for not getting back to you sooner.

 

In the installation, you added code to the english/product_info.php file to support this contribution. Here's the instructions for that step:

 

	6c) [catalog/]includes/languages/english/product_info.php
	Add anywhere before the final "?>"

	/* Optional Related Products (ORP) */
	define('TEXT_RELATED_PRODUCTS', 'Other Products You Might Like');
	define('RELATED_PRODUCTS_MODEL_COMBO', ' (%s)');
	define('RELATED_PRODUCTS_PRICE_TEXT', '@ %s');
	define('RELATED_PRODUCTS_QUANTITY_TEXT', 'Only %s left!');
	/***********************************/

To remove the '@' from the price line, change the definition, like this:

 

		define('RELATED_PRODUCTS_PRICE_TEXT', '%s');

This may seem a bit silly to have a constant that only displays a variable, but in general it makes more sense to not modify the module code to facilitate any possible future upgrades. It isn't necessary to have a space at the beginning and end as the price will be centered.

 

If you want to control the space between the lines, use CSS to change/remove the padding and/or margins for the paragraph tag used in the module.

 

Here's the info from the install file about that

 

Optional Step:

The "name", "model", "name & model", "price" and "quantity" text are each wrapped
in html paragraph tags ( "<p>" and "</p>"). To control the space between these lines,
you can add a CSS definition for the class "productListing-data" in stylesheet.css.

	Look For:

	TD.productListing-data {

	Add your new class definition immediately below the existing definition,
	after the ending curly bracket. Here is where you would make changes to
	the font face, style, size, color, etc.

	TD.productListing-data p {
	  margin:2px;
	  padding:0;
	  text-align:center;
	}

Removing the link from the price is a bit more work, and requires modifying the module itself. On line 81, find and remove the following code:

 

	  if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {
	$caption .= '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";
  }

Now find the code that writes the link, around line 84 after remove the code above:

 

	  echo '<a href="'
					. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'
					. $caption . '</a>' . "\n";

and add this immediately following the code for the product link:

 

	  if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {
	echo '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";
  }

It should end up looking like this:

 

	  echo '<a href="'
					. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'
					. $caption . '</a>' . "\n";
  if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {
	echo '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";
  }

Let us know if this resolves the issues for you.

 

Thanks for the kudos. A lot of work went into the contribution, by a lot of people over the course of several years. I'm sure I speak for all of them, myself included, when I say "you're welcome."

 

To your success!

-Skittles

Link to comment
Share on other sites

never mind, sorted this out by (backup first) removing... but then I had an error

1146 - Table '******.products_related_products' doesn't exist

 

SELECT pa.* FROM products_related_products pa LEFT JOIN products_description pd ON pa.pop_products_id_master = pd.products_id AND pd.language_id = '1' ORDER BY pd.products_name, pa.pop_order_id, pa.pop_id

 

I stil had bits left in the admin so I ran remove again and then install new and hey presto!

 

after an iffy install causing it in the first place all seems well and running nice, many thanks for this contrib :thumbsup:

Link to comment
Share on other sites

Anita,

before upgrading to version 4 I wanted to know if this new version is able to show the products' code instead of just the name in the admin panel.

I have several products with similar or identical name in my catalog, but they are very different products indeed.. so the only way for me to recognize them is by their code.

 

in a previous thread you sent a change to products_options.php file to show the code and not the name. I hope that this improvement has been brought into version 4.0.

 

if no, how can I do that in the new version?

thanks

 

Stefano

Link to comment
Share on other sites

Anita,

before upgrading to version 4 I wanted to know if this new version is able to show the products' code instead of just the name in the admin panel.

I have several products with similar or identical name in my catalog, but they are very different products indeed.. so the only way for me to recognize them is by their code.

 

in a previous thread you sent a change to products_options.php file to show the code and not the name. I hope that this improvement has been brought into version 4.0.

 

if no, how can I do that in the new version?

thanks

 

Stefano

Stefano,

 

Yes, that is one of the options.

 

-Skittles

Link to comment
Share on other sites

  • 3 weeks later...

Anita

 

just found a bug related to this:

 

2) Add code to [catalog/]admin/categories.php, case 'delete_product_confirm':
  to remove all Related Product entries containing the removed product.
  Find, on or around line 154:
         if ($product_categories['total'] == '0') {
           tep_remove_product($product_id);
         }
       }

  Replace with:
         if ($product_categories['total'] == '0') {
           tep_remove_product($product_id);
         }
       /* Optional Related Products (ORP) */
         tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
         tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
       //ORP: end
       }

 

This is not a good place for the two queries lines above.

 

If a user deletes a whole category (tree), all products in the category tree will be deleted but TABLE_PRODUCTS_RELATED_PRODUCTS entries WILL NOT be deleted.

 

The right place for the two queries is inside the tep_remove_product function that is called in both cases: single product delete or whole category tree delete.

 

 

Have a nice day

Marcus

Link to comment
Share on other sites

Anita

 

just found a bug related to this:

 

2) Add code to [catalog/]admin/categories.php, case 'delete_product_confirm':
  to remove all Related Product entries containing the removed product.
  Find, on or around line 154:
         if ($product_categories['total'] == '0') {
           tep_remove_product($product_id);
         }
       }

  Replace with:
         if ($product_categories['total'] == '0') {
           tep_remove_product($product_id);
         }
       /* Optional Related Products (ORP) */
         tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
         tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
       //ORP: end
       }

 

This is not a good place for the two queries lines above.

 

If a user deletes a whole category (tree), all products in the category tree will be deleted but TABLE_PRODUCTS_RELATED_PRODUCTS entries WILL NOT be deleted.

 

The right place for the two queries is inside the tep_remove_product function that is called in both cases: single product delete or whole category tree delete.

Have a nice day

Marcus

Marcus,

 

Thank you for point this out. I'll definitely move the code for the next release.

 

-Skittles

Link to comment
Share on other sites

Great Contribution, thanks for all your hard work :thumbsup:

 

Just wondered if anyone had ever tried a horizontal 'list' layout as found at http://www.pixmania.co.uk/uk/uk/88654/art/....html?itag=4577

 

Or if anyone knows how to achieve that with this modification.

 

thanks.

Benji_m,

 

Early versions of this contribution displayed the Related Products much like a regular product listing. If you are feeling adventurous, you could download the an early version (about the time they added images,) and try modifying the [catalog/]includes/modules/optional_related_products.php file using the old code as a guide. That way you could have the list as you prefer, without losing the options available in Version 4.0.

 

I'm sorry that I don't have the time right now to give you a hand. I need to take care of my clients, so I can pay my bills... (I bet that sounds familiar to a lot of folks reading this thread!)

 

Good luck,

-Skittles

Link to comment
Share on other sites

Hello I have quick question.

 

I am about to install this contribution, after reading user guide it looks like from the admin side you are selecting items from the drop down menu to relate them to each other.

 

So my concern is I have over 20.000 products, and I don’t really want to load them to the drop down menu because it will take forever.

Should I be concern or should I go ahead with installing it?

 

Thanks

 

Martin.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Skitties - this is excellent!!!

 

Here's my client's site: www.lifestylelogic.com.au

 

What he's after is that during the order process - when the client has clicked on BUY NOW on a product and the client is on the CART page - he wants to be able to lure clients on that page with related products so they can click on BUY NOW....

 

Coz right now - related products are only available on the product info pages.

 

Can you suggest what would be the best way for me to achieve this?

 

Thanks

Link to comment
Share on other sites

Hi Skitties - this is excellent!!!

 

Here's my client's site: www.lifestylelogic.com.au

 

What he's after is that during the order process - when the client has clicked on BUY NOW on a product and the client is on the CART page - he wants to be able to lure clients on that page with related products so they can click on BUY NOW....

 

Coz right now - related products are only available on the product info pages.

 

Can you suggest what would be the best way for me to achieve this?

 

Thanks

Yking,

 

The Related Products module uses the product_id from the url to find the products that are related. When you are in the shopping cart, there isn't a product code in the url.

 

One possible solution would be to add some code to the cart that writes the product code into a variable. With each product the code would be overwritten, so the variable would contain the id for the last product added into the cart.

 

Then modify the optional_related_products.php module.

 

In order to use the same file for both pages, add a bit of code to the beginning of the file that sets your variable to $HTTP_GET_VARS['products_id'] if it exists. Then, in the query statement, change $HTTP_GET_VARS['products_id'] to your variable.

 

Then call the module the same as you do from the product page.

 

-Skittles

Link to comment
Share on other sites

  • 4 weeks later...

Having installed Optional Related Products I get this error:

 

Fatal error: Cannot redeclare tep_get_products_description() (previously declared in /home/simplyst/public_html/catalog/admin/includes/functions/general.php:515) in /home/simplyst/public_html/catalog/admin/includes/functions/general.php on line 522

 

Does anyone know what I've done wrong. I'm guessing it's to do with step 4a.

 

After making the changes my file looks like this:

 

function tep_get_products_model($product_id) {
	  $product_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
	  $product = tep_db_fetch_array($product_query);

	  return $product['products_model'];
	}

	function tep_get_products_description($product_id, $language_id) {
	  $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
	  $product = tep_db_fetch_array($product_query);

	  return $product['products_description'];
	}

 function tep_get_products_description($product_id, $language_id) {
$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_description'];
 }

Link to comment
Share on other sites

Having installed Optional Related Products I get this error:

 

Fatal error: Cannot redeclare tep_get_products_description() (previously declared in /home/simplyst/public_html/catalog/admin/includes/functions/general.php:515) in /home/simplyst/public_html/catalog/admin/includes/functions/general.php on line 522

 

Does anyone know what I've done wrong. I'm guessing it's to do with step 4a.

 

After making the changes my file looks like this:

 

function tep_get_products_model($product_id) {
	  $product_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
	  $product = tep_db_fetch_array($product_query);

	  return $product['products_model'];
	}

	function tep_get_products_description($product_id, $language_id) {
	  $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
	  $product = tep_db_fetch_array($product_query);

	  return $product['products_description'];
	}

 function tep_get_products_description($product_id, $language_id) {
$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_description'];
 }

PJ2006,

 

Just remove the second instance of the tep_get_products_description() function.

 

-Skittles

Link to comment
Share on other sites

This does seem like the best xsell contrib....but perhaps I am missing something;

 

Using a simple example, you might be selling a camera, and you want a memory card to be a related product;

 

Scenario1

The customer has the camera product info screen up, and at the bottom the related memory card will be displayed...great. However, as soon as the customer clicks to buy the camera, they are taken away from the page which had the optional memory card.

 

Scenario2

The customer has the camera product info screen up,and at the bottom the related memory card will be displayed....so the customer clicks on the memory card....and now is taken away from the screen with the camera on it....so has to research and find the item, if they can be bothered.

 

what is needed in my opinion is the following option;

 

The customer has the screen with a cemra open.....no cross selling items are displayed. After, and ONLY after the customer clicks on add to cart, they are given the option to buy the related products.

 

If I missed something about how cross sell contributions work?

Link to comment
Share on other sites

Is there any optional language support for Optional related products 4.0 contrib

Thanks

 

Thomas

Thomas,

 

I do not have the language skills to support any language besides English.

 

I had hoped that other community members would come forward and add support for other languages, but so far no one has contacted me or added language support to the contribution area.

 

If you would like to work with me on it, I'll be more than happy to provide support for an additional language.

 

-Skittles

Link to comment
Share on other sites

Thomas,

 

I do not have the language skills to support any language besides English.

 

I had hoped that other community members would come forward and add support for other languages, but so far no one has contacted me or added language support to the contribution area.

 

If you would like to work with me on it, I'll be more than happy to provide support for an additional language.

 

-Skittles

 

Thanks for the quick reply, Unfortunately, I'm not a php programmer and only know english :). Although I am familiar with php and Mysql my understanding is limited.

 

Its too bad no-one contributed to the language files for this mod...related or upsell items are a common occurrence in most shopping cart programs now.

 

I'm way to far into setting up this software (oscommerce) for a client that wants to sell globally, to start over with some other software. I hope and pray someone is working on it, related products will be the only part of my store without multi-language support. :(

 

Great contrib Skittles Keep up the fantastic work :)

 

Thomas

Link to comment
Share on other sites

This does seem like the best xsell contrib....but perhaps I am missing something;

 

Using a simple example, you might be selling a camera, and you want a memory card to be a related product;

 

Scenario1

The customer has the camera product info screen up, and at the bottom the related memory card will be displayed...great. However, as soon as the customer clicks to buy the camera, they are taken away from the page which had the optional memory card.

 

Scenario2

The customer has the camera product info screen up,and at the bottom the related memory card will be displayed....so the customer clicks on the memory card....and now is taken away from the screen with the camera on it....so has to research and find the item, if they can be bothered.

 

what is needed in my opinion is the following option;

 

The customer has the screen with a cemra open.....no cross selling items are displayed. After, and ONLY after the customer clicks on add to cart, they are given the option to buy the related products.

 

If I missed something about how cross sell contributions work?

tractormad,

 

The option you would prefer would require an extra database query for every product page, looking for the item in the visitor's shopping cart. Every query slows down loading the page. Shopping carts are slow enough as it is... :)

 

One way around your dilemma would be to change the configuration so that the visitor is not taken to the shopping cart after adding a product.

 

Once the product is added, the page will be refreshed, and the related products will still be shown. Make sure the camera and memory card are related both directions (reciprocate), and the camera will display as a related product when the memory card is being viewed.

 

I hope this helps.

 

-Skittles

Link to comment
Share on other sites

Thanks for the quick reply, Unfortunately, I'm not a php programmer and only know english :). Although I am familiar with php and Mysql my understanding is limited.

 

Its too bad no-one contributed to the language files for this mod...related or upsell items are a common occurrence in most shopping cart programs now.

 

I'm way to far into setting up this software (oscommerce) for a client that wants to sell globally, to start over with some other software. I hope and pray someone is working on it, related products will be the only part of my store without multi-language support. :(

 

Great contrib Skittles Keep up the fantastic work :)

 

Thomas

Thomas,

 

It sounds like you really only need support for the catalog side, not the admin.

 

There are only four language constants added to the language files for product_info.php:

 

  /* Optional Related Products (ORP) */
 define('TEXT_RELATED_PRODUCTS', 'Other Products You Might Like');
 define('RELATED_PRODUCTS_MODEL_COMBO', ' (%s)');
 define('RELATED_PRODUCTS_PRICE_TEXT', '@ %s');
 define('RELATED_PRODUCTS_QUANTITY_TEXT', 'Only %s left!');
 /***********************************/

What languages will your client's shop support?

 

If you list them here, maybe we can get a response from one or more folks reading this thread who will translate the these lines for you.

 

It's worth a try...

 

-Skittles

Link to comment
Share on other sites

Hi,

 

I've just installed this contribution and got confused as it's not working for me.

Well the store is still running without getting any bugs, the configuration and management in Admin area works OK, but there's nothing displayed at product info page.

I am using the STS contrib and made several tests. I have placed the insertion PHP script (that includes the optional_related_products.php) to my template and nothing has changed, even when I've pasted the entire code of optional_related_products.php to the template. No HTML tags, no images, nothing.

 

Any ideas?

 

Thank you.

Link to comment
Share on other sites

I'm having a problem with step #5

 

here is my admin/includes/boxes/catalog.php before

 

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  // BOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_ADDITIONAL_IMAGES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_IMAGES_PRODUCTS . '</a><br>' .
                                  // EOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
//kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons 
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->

 

and here's it after

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  // BOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_ADDITIONAL_IMAGES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_IMAGES_PRODUCTS . '</a><br>' .
                                  // EOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
//kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                   '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
       /* Optional Related Products (ORP) */
       '<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>');
       //ORP:end
                                  ***************/
                                  //end kgt - discount coupons 
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->

 

But I keep getting this when I'm trying to access the configuration in my admin

"Parse error: syntax error, unexpected ')' in /home/pixyc4/public_html/admin/includes/boxes/catalog.php on line 38"

 

any ideas?

Link to comment
Share on other sites

I'm having a problem with step #5

 

here is my admin/includes/boxes/catalog.php before

 

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  // BOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_ADDITIONAL_IMAGES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_IMAGES_PRODUCTS . '</a><br>' .
                                  // EOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
//kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons 
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->

 

and here's it after

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  // BOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_ADDITIONAL_IMAGES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_IMAGES_PRODUCTS . '</a><br>' .
                                  // EOF: Additional Images
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
//kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                   '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
       /* Optional Related Products (ORP) */
       '<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>');
       //ORP:end
                                  ***************/
                                  //end kgt - discount coupons 
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->

 

But I keep getting this when I'm trying to access the configuration in my admin

"Parse error: syntax error, unexpected ')' in /home/pixyc4/public_html/admin/includes/boxes/catalog.php on line 38"

 

any ideas?

natasha21,

 

Two problems. 1) When you installed the "Discount Coupons" contribution, you commented out a line of code. When you added the code for "Optional Related Products", you placed it within those comments. 2) The line of code adding the link for Discount Coupons ended the php statement. To add a line of code to the statement, the parenthesis and semi-colon ( ");" ) need to be moved to the end of the new line of code. Also, html for the line break needs to be added.

 

In your admin/includes/boxes/catalog.php file, remove the everything from "//kgt - discount coupons" to "//end kgt - discount coupons", including these comments, and replace it with the following code:

 

//kgt - discount coupons
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
'<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a><br>'.
/***************
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
***************/
//end kgt - discount coupons
/* Optional Related Products (ORP) */
'<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>');
//ORP:end

That should solve your error message problem.

 

-Skittles

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