Jump to content
Sign in to follow this  
Waza04

[Contribution] Product Options Module

Recommended Posts

added contrib to MS1 version - problem now however is that when I click on Tell A Friend - I am redirected to my shopping cart and the product that I wanted to tell a friend about is now added to my shopping cart...

 

 

HELP!

Share this post


Link to post
Share on other sites

Since I was posting this I decided to check the other boxes and see how they work:

 

The manufacturers link does not work - it redirects to default.php - it doesn't seem to be pulling the manufacture ID.

 

Reviews and Notifications work fine.

 

 

So sum that up =

 

 

Tell a Friend redirects to and adds product to shopping cart and

 

Manufacturers Box redirects back to default.php?manufacturers_id=

but does not include the manufacture id so the default.php page is what is displayed.

Share this post


Link to post
Share on other sites

not that this matters that much and is a pretty easy fix - but when I was installing the mod - you referred to column_left.php when you should have referred to column_right.php to edit the code....

 

just a typo ...

Share this post


Link to post
Share on other sites

just checking in again regarding the manufactures box and the tell a friend box that is moved to bottom of product info via your products options box

 

any updates on why the manufactures box is not recognizing an id? It actually isn't pulling anything when the box is listed on the product_info page either - example - manufacturer id 1 should show picture of shoe - but no picture is displayed -so the issue isn't on the click through - it sits with the actual box on the info page

 

 

any updates on the tell a friend not "telling a friend" as well??? :)

 

thanks!

Share this post


Link to post
Share on other sites

Ive manage to sort the manufacturer out = but cant seem to get the tell a friend to work :? :?

 

If somebody could take a look - Id be very gratefull!!

 

Warren

Share this post


Link to post
Share on other sites

I've been digging into the code as well - thought I had the manufacture issue resolved myself but now I have a parse error

 

Parse error: parse error, unexpected $

 

in products_options.php

 

I thought it was just missing the db query

 

 

can you post what you did to make it work?

Share this post


Link to post
Share on other sites

Sure - For Manufactures To Work:

 

Find:

//Manufacturer String

  $manufacturer_info_string = '<div align="center">' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '</div>' .

                              '<table border="0" width="' . BOX_WIDTH . '" cellspacing="0" cellpadding="0">';

 if ($has_manufacturer_url == 'true') $manufacturer_info_string .= '<tr><td valign="top" class="infoBoxContents"></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id'], 'NONSSL') . '" target="_blank">' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></td></tr>';

 $manufacturer_info_string .= '<br><tr><td valign="top" class="infoBoxContents"></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id'], 'NONSSL') . '">' . BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '</a></td></tr></table>';

 

 

Replace With:

//Manufacturer String

   $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . $languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

   if (tep_db_num_rows($manufacturer_query)) {

     $manufacturer = tep_db_fetch_array($manufacturer_query);

     $manufacturer_info_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

     if (tep_not_null($manufacturer['manufacturers_image'])) $manufacturer_info_string .= '<tr><td align="center" class="infoBoxContents" colspan="2">' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '</td></tr>';

     if (tep_not_null($manufacturer['manufacturers_url'])) $manufacturer_info_string .= '<tr><td valign="top" class="infoBoxContents">- </td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank">' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></td></tr>';

     $manufacturer_info_string .= '<tr><td valign="top" class="infoBoxContents">- </td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '</a></td></tr>' .

                                  '</table>';

That should be it!!

 

Warren

Share this post


Link to post
Share on other sites

okay fixed the manufacturers on my end:

 

changed products_option.php page to read this:

 

 

<?php

/*

$Id: product_options.php, v1.0 2003/04/19 14:14:14 waza04_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce / Warren Ashcroft

 

Support:

oscdev@ukcomputersystems.com

waza04@hotmail.com (MSN Messenger)

 

Paypal Donations:

paypal@ukcomputersystems.com

 

Web:

http://www.ukcomputersystems.com/

 

Released under the GNU General Public License

*/

if (isset($HTTP_GET_VARS['products_id'])) {

$manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name,

 

m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " .

 

TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id

 

= '" . $languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" .

 

(int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

if (tep_db_num_rows($manufacturer_query)) {

$manufacturer = tep_db_fetch_array($manufacturer_query);

?>

 

<?php

//Manufacturer String

$manufacturer_info_string = '<div align="center">' . tep_image(DIR_WS_IMAGES .

 

$manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '</div>' .

'<table border="0" width="' . BOX_WIDTH . '" cellspacing="0"

 

cellpadding="0">';

if ($has_manufacturer_url == 'true') $manufacturer_info_string .= '<tr><td valign="top"

 

class="infoBoxContents"></td><td valign="top" class="infoBoxContents"><a href="' .

 

tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' .

 

$manufacturer['manufacturers_id'], 'NONSSL') . '" target="_blank">' .

 

sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></td></tr>';

$manufacturer_info_string .= '<br><tr><td valign="top" class="infoBoxContents"></td><td

 

valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_DEFAULT,

 

'manufacturers_id=' . $manufacturer['manufacturers_id'], 'NONSSL') . '">' .

 

BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '</a></td></tr></table>';

 

 

// Reviews String

if ($HTTP_GET_VARS['products_id']) {

$reviews = '<table border="0" cellspacing="0" cellpadding="2"><tr><td

 

class="infoBoxContents"><p align="center"><a href="' .

 

tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id'],

 

'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) .

 

'</a></td><td class="infoBoxContents"><p align="center"><a href="' .

 

tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id'],

 

'NONSSL') . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table></td>';

}

 

 

// Notifacations String

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . "

 

where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id

 

. "'");

$check = tep_db_fetch_array($check_query);

 

if ($check['count'] > 0) {

$notif_text = '<table border="0" cellspacing="0" cellpadding="2"><tr><td

 

class="infoBoxContents"><p align="center"><a href="' . tep_href_link(basename($PHP_SELF),

 

tep_get_all_get_params(array('action')) . 'action=notify_remove', 'NONSSL') . '">' .

 

tep_image(DIR_WS_IMAGES . 'box_products_notifications_remove.gif',

 

IMAGE_BUTTON_REMOVE_NOTIFICATIONS) . '</a></td><td class="infoBoxContents"><p align="center"><a

 

href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) .

 

'action=notify_remove', 'NONSSL') . '">' . sprintf(BOX_NOTIFICATIONS_NOTIFY_REMOVE,

 

tep_get_products_name($HTTP_GET_VARS['products_id'])) .'</a></td></tr></table></td>';

} else {

$notif_text = '<table border="0" cellspacing="0" cellpadding="2"><tr><td

 

class="infoBoxContents"><p align="center"><a href="' . tep_href_link(basename($PHP_SELF),

 

tep_get_all_get_params(array('action')) . 'action=notify', 'NONSSL') . '">' .

 

tep_image(DIR_WS_IMAGES . 'box_products_notifications.gif', IMAGE_BUTTON_NOTIFICATIONS) .

 

'</a></td><td class="infoBoxContents"><p align="center"><a href="' .

 

tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify',

 

'NONSSL') . '">' . sprintf(BOX_NOTIFICATIONS_NOTIFY,

 

tep_get_products_name($HTTP_GET_VARS['products_id'])) .'</a></td></tr></table></td>';

}

 

 

// Tell A Friend String

if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) {

$hide = tep_draw_hidden_field('products_id', $HTTP_GET_VARS['products_id']);

$hide .= tep_hide_session_id();

$tell_friend = '<form name="tell_a_friend" method="get" action="' .

 

tep_href_link(FILENAME_TELL_A_FRIEND, '', 'NONSSL', false) . '"><div align="center">' .

 

tep_draw_input_field('send_to', '', 'size="10"') . ' ' .

 

tep_image_submit('button_tell_a_friend.gif', BOX_HEADING_TELL_A_FRIEND) . $hide . '</div><br><p

 

align="center">' . BOX_TELL_A_FRIEND_TEXT . '</td>';

}

 

//Draw Table

$box_table = '

<table border="0" cellpadding="0" cellspacing="0" width="100%" class="infoBox>

<tr>

<td width="25%" class="infoBoxContents"></td>

<td width="25%" class="infoBoxContents"><center>' . BOX_TEXT_MANUFACTURER_INFO .

 

tep_draw_separator('pixel_trans.gif', '100%', '10') . '<br></td></center>

<td width="25%" class="infoBoxContents"><center>' . BOX_TEXT_WRITE_REVIEW .

 

tep_draw_separator('pixel_trans.gif', '100%', '10') . '<br></td></center>

<td width="25%" class="infoBoxContents"><center>' . BOX_TEXT_PRODUCT_NOTIFICATIONS .

 

tep_draw_separator('pixel_trans.gif', '100%', '10') . '<br></td></center>

<td width="25%" class="infoBoxContents"><center>' . BOX_TEXT_TELL_FRIEND .

 

tep_draw_separator('pixel_trans.gif', '100%', '10') . '<br></td></center>

</tr>

 

<tr>

<td width="25%" class="infoBoxContents">' . $manufacturer_info_string . '

<td width="25%" class="infoBoxContents">' . $reviews . '

<td width="25%" class="infoBoxContents">' . $notif_text . '

<td width="25%" class="infoBoxContents">' . $tell_friend . '

</tr>

 

</table>';

 

 

 

//Draw Box

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => BOX_HEADING_PRODUCT_OPTIONS);

new contentBoxHeading($info_box_contents, true, false);

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => $box_table);

 

 

new infoBox($info_box_contents);

?>

 

<?php

}

}

?>

 

 

hope this is right and hope it helps someone else - simply copy and paste the code -

 

this is what I added at the top of the code under Release

 

 

if (isset($HTTP_GET_VARS['products_id'])) {

$manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name,

 

m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " .

 

TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id

 

= '" . $languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" .

 

(int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

if (tep_db_num_rows($manufacturer_query)) {

$manufacturer = tep_db_fetch_array($manufacturer_query);

?>

 

<?php

 

then added this:

 

<?php

}

}

?>

 

 

at end of file

Share this post


Link to post
Share on other sites

Warren,

 

Could you please elaborate on my errors - I tried to include your change and I received errors - I applied my mod and it worked...

 

any more progress on the tell a friend part?

Share this post


Link to post
Share on other sites

If yours works - then hey - its fine!!

 

However, I am really struggling with the tell a friend - it has something to do with OSC form functions :cry: :cry:

 

Warren

Share this post


Link to post
Share on other sites

OK, Version 2 Is OUT NOW!!!

 

http://www.oscommerce.com/community/contributions,1183

 

**************************************

Product Options Module V2.0

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Fixes a few bugs regarding the tell a friend.

- Fixes a few bugs regarding the manufacturer.

 

(MAJOR - UPGRADE VERSION AVAILABLE)

 

**************************************

Share this post


Link to post
Share on other sites

Hi,

 

Is there any webadress where we can take a look on this contribution in real life ?

 

 

Greetings Sam.

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
Sign in to follow this  

×