Jump to content
Sign in to follow this  
Jack_mcs

Request Product Info

Recommended Posts

Jack, no worries.. I found another contribution and modified it for my needs. Thanks anyways! Have a Merry Christmas!

 

James

Share this post


Link to post
Share on other sites

A new version has been uploaded. It contains these changes:

 

- Changed code in request-product-info.php for Mysql 5 compatibility

- Added table width to provide a more consistent appearance

- Fixed code to work properly with products with attributes

 

The last change should fix the problem some people are having getting this to work. The failure, from what I could see, only happened with a product that had attributes. I hadn't tested with that previously but could get it to fail when I did.

 

Jack

Share this post


Link to post
Share on other sites

Hi there,

many thanks for this great little contribution. It's all working fine on our site: Drum Central

 

I wondered if you could help me with one minor thing?

 

When a customer is logged into the site, and clicks on the regular 'Contact Us' link, his or her name and email address are automatically filled in on the form.

However, when using the 'Product Request' link the name or email address are not pre-filled.

It would be great if you had any clues.....


--------------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

You need to read in the customer information from the database and fill it in. Since the email form used in this contribution is based on the contact us code, you should be able to compare the two and just copy the needed code to get it to work. It's a good idea though for a futer version.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack.

 

Thanks for the info. After a bit of experimenting I managed to find the code in the catalog/contact_us.php file and inserted it into the catalog/request-product-info.php file.

 

After Line 114, which should be:

 

<?php
 if ($messageStack->size('request_info') > 0) {
?>

 

insert this code from the catalog/contact_us file:

 

<?php
 } else {
 if (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $email = $account['customers_email_address'];
 }
?>

 

This should automatically add the logged-in customers name and email address the the form fields.

 

I hope this is of some use to everyone.

 

Thanks again.


--------------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Sorry to hear that it's not working for you.

I am using the latest version of this mod, and it works for my site.

There's probably something in your code, if you've previously modified your oscommerce files.

I know it seems to work better with Firefox (surprise!)


--------------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites
A new version has been uploaded. It contains these changes:

 

- Changed code in request-product-info.php for Mysql 5 compatibility

- Added table width to provide a more consistent appearance

- Fixed code to work properly with products with attributes

 

The last change should fix the problem some people are having getting this to work. The failure, from what I could see, only happened with a product that had attributes. I hadn't tested with that previously but could get it to fail when I did.

 

Jack

 

Hi Jack,

 

Is there a possibility the contribution could work in this scenario: several products are added to the "cart" by a customer, and then once the customer is finished 'shopping' he/she enters the cart, and only one button is made available to "request information" on the collective group of products at once?

 

Thanks for this great tool!

 

Erick

Share this post


Link to post
Share on other sites
Hi Jack,

 

Is there a possibility the contribution could work in this scenario: several products are added to the "cart" by a customer, and then once the customer is finished 'shopping' he/she enters the cart, and only one button is made available to "request information" on the collective group of products at once?

 

Thanks for this great tool!

 

Erick

It has that option already. If you don't want the request button on the product page, it can be removed.

 

Jack

Share this post


Link to post
Share on other sites
It has that option already. If you don't want the request button on the product page, it can be removed.

 

Jack

 

It was a while since I checked in, and thanks for the response. I will begin installing your contribution, and looking forward to it.

 

Thanks again Jack

 

Erick

Share this post


Link to post
Share on other sites

Hello Jack,

 

This is terriffic ! One question : can it be modified so that it can show up only on certain products rather than all? I have some products that do not need it. I'm definitely not en expert on reworking code and since I all your contribs that I use installed easily. I'm still on MS2.2 and with Mysql 4.1.3.

 

Thank you in advance!

Share this post


Link to post
Share on other sites
Hello Jack,

 

This is terriffic ! One question : can it be modified so that it can show up only on certain products rather than all? I have some products that do not need it. I'm definitely not en expert on reworking code and since I all your contribs that I use installed easily. I'm still on MS2.2 and with Mysql 4.1.3.

 

Thank you in advance!

In the product_info.php file, locate this line of code, which was added by this contribution

  <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>

Change that to

<?php 
$prodArray = array();
$prodArray[] = XX;
$prodArray[] = YY;
$prodArray[] = ZZ;
if (in_array($product_info['products_id'], $prodArray) { ?>
 <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>
<?php } ?>

where XX, YY and ZZ are product id numbers you want to enable. You can add as many as you want by just copying the line, $prodArray[] = ZZ;, and changing the ZZ to some ID. I haven't tested this so be sure to backup your file first. As for the shopping cart request button, the same process should work but $product_info would be different. And it would require more code since there may be mixed products in the cart so more chekcing would need to be done to make sure only the wanted ones are asked about.

 

Jack

Share this post


Link to post
Share on other sites
In the product_info.php file, locate this line of code, which was added by this contribution
  <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>

Change that to

<?php 
$prodArray = array();
$prodArray[] = XX;
$prodArray[] = YY;
$prodArray[] = ZZ;
if (in_array($product_info['products_id'], $prodArray) { ?>
 <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>
<?php } ?>

where XX, YY and ZZ are product id numbers you want to enable. You can add as many as you want by just copying the line, $prodArray[] = ZZ;, and changing the ZZ to some ID. I haven't tested this so be sure to backup your file first. As for the shopping cart request button, the same process should work but $product_info would be different. And it would require more code since there may be mixed products in the cart so more chekcing would need to be done to make sure only the wanted ones are asked about.

 

 

Thanks Jack, I'll try tonight when there are fewer customers on the website... with 3,000 products this might not be an easy way to go! Should you think of a way to be able to toggle from Admin. I don't need it in the shopping cart, just on the products pages. Thanks again.

 

Mandy

Jack

Share this post


Link to post
Share on other sites

It's possible to set them from admin but that is not a quick change and is beyond the scope of forum help.

 

Jack

Share this post


Link to post
Share on other sites

hello,

 

I installed the contibution in product info. the result appears in request product info, but I have not received any detail of the product in mail.

 

The name, phone and more. I see

 

(For info, I had to remove column_left.php and column_right.php to request_product_info.php for use in my template)

 

 

Thanks for replay

 

 

Steph from Switzerland

 

(Sorry for my English) :blush:

Edited by stephano6

Share this post


Link to post
Share on other sites

Te code uses the same code to send emails that is standard in the shop so if your other email works, it should too. Do you receive an email when an order is placed? Are the email fields set in admin->Configuraiton?

 

Jack

Share this post


Link to post
Share on other sites
In the product_info.php file, locate this line of code, which was added by this contribution
  <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>

Change that to

<?php 
$prodArray = array();
$prodArray[] = XX;
$prodArray[] = YY;
$prodArray[] = ZZ;
if (in_array($product_info['products_id'], $prodArray) { ?>
 <td class="main" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_REQUEST_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_request_product_info.gif', IMAGE_BUTTON_REQUEST_PRODUCT_INFO) . '</a>'; ?></td>
<?php } ?>

where XX, YY and ZZ are product id numbers you want to enable. You can add as many as you want by just copying the line, $prodArray[] = ZZ;, and changing the ZZ to some ID. I haven't tested this so be sure to backup your file first. As for the shopping cart request button, the same process should work but $product_info would be different. And it would require more code since there may be mixed products in the cart so more chekcing would need to be done to make sure only the wanted ones are asked about.

 

Jack

 

 

Thanks ever so much Jack... I spent the night playing around with the OSC product status function and found that it could be adapted so with your fantastic contribution (which was much lacking in my store for certain products) I now have it controlled from ADMIN with "status" buttons on the product page and in New products so I can just activate the contrib on the products needing it.

 

Without you I never would never have thought I could have this ! Thanks so much.

 

Mandy

Share this post


Link to post
Share on other sites
hello,

 

I installed the contibution in product info. the result appears in request product info, but I have not received any detail of the product in mail.

 

The name, phone and more. I see

 

(For info, I had to remove column_left.php and column_right.php to request_product_info.php for use in my template)

Thanks for replay

Steph from Switzerland

 

(Sorry for my English) :blush:

 

----------------------------------------------------------------- Email Return -------------------------

Sebastien has asked for information about the following product(s):

 

ID PRODUCT

 

 

 

Here is the contact information for fgfgfgfgfgfg

 

Phone: 43643623

Email Address: seb@test.com

Mailing Address: 3 rue des arbres

Additional Comments: merci

 

---------------------------------------------

I did not change to

 

{

$products = TEXT_PRODUCT_COLUMNS;

for ($i = 0; $i < count($productList); ++$i)

{

$product_info_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$productList[$i] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

$products .= $product_info['products_id'] . "\t" . $product_info['products_name'] . "\n";

}

------------------------------------------------

Please help, Thanks

Share this post


Link to post
Share on other sites

Hi,

the Problem is the unserialize command instead myunserialize function call ,

at line 31 find

$productList = unserialize($_POST['productList']);

 

change to

 

$productList = myunserialize($_POST['productList']);

and then all works

 

Regards

 

Vincenzo

 

 

 

----------------------------------------------------------------- Email Return -------------------------

Sebastien has asked for information about the following product(s):

 

ID PRODUCT

Here is the contact information for fgfgfgfgfgfg

 

Phone: 43643623

Email Address: seb@test.com

Mailing Address: 3 rue des arbres

Additional Comments: merci

 

---------------------------------------------

I did not change to

 

{

$products = TEXT_PRODUCT_COLUMNS;

for ($i = 0; $i < count($productList); ++$i)

{

$product_info_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$productList[$i] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

$products .= $product_info['products_id'] . "\t" . $product_info['products_name'] . "\n";

}

------------------------------------------------

Please help, Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I am not good in coding. I need a help.

I have in shopping_cart.php to limit that only registered user can REQEST INFORMATION.Otherwise, when it is clicked on REQEUST BUTTON, the guest should get login page or just be informed that he should login.

 

Thanks

Edited by pageyu

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Hi Jack, first of all great contribution, perfect for what I needed well nearly,

 

All works after fixing as per previous posts,

 

Only problem i have when we go to the request-product-info.php page

 

I get the word Array ( in the Name input field )

 

The script works, emails all details etc, just unsure how to fix the input value.

 

Using Latest PHP and MYSQL.

 

Any help appreciated, obviously i need to blank the value just dont know how ?

 

Nicky

Share this post


Link to post
Share on other sites

Which version are you using? I only support my versions and, as far as I know, it works fine.

 

Jack

Share this post


Link to post
Share on other sites

I've Post , the Fix for the Bug that IF NAME ecc FIELD is NULL , Script does not print ERROR (This bug is in the EDIT of Automatic NAME IF User is LOG IN by DRUMCENTRAL http://forums.oscommerce.com/index.php?sho...t&p=1182470 )

 

 

At LINE 117
FIND 

<?php
 if ($messageStack->size('request_info') > 0) {
?>
<?php
 } else {
 if (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $email = $account['customers_email_address'];
 }
?>
     <tr>
       <td><?php echo $messageStack->output('request_info'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {



AND REPLACE IT WITH

<?php
  if ($messageStack->size('request_info') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('request_info'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 } else {
 if (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $email = $account['customers_email_address'];
 }
 }


 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {

Share this post


Link to post
Share on other sites
I've Post , the Fix for the Bug that IF NAME ecc FIELD is NULL , Script does not print ERROR (This bug is in the EDIT of Automatic NAME IF User is LOG IN by DRUMCENTRAL http://forums.oscommerce.com/index.php?sho...t&p=1182470 )

 

 

At LINE 117
FIND 

<?php
 if ($messageStack->size('request_info') > 0) {
?>
<?php
 } else {
 if (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $email = $account['customers_email_address'];
 }
?>
     <tr>
       <td><?php echo $messageStack->output('request_info'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {



AND REPLACE IT WITH

<?php
  if ($messageStack->size('request_info') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('request_info'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 } else {
 if (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $email = $account['customers_email_address'];
 }
 }


 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {

 

 

hey your fix doesnt work by me

 

@Jack_mcs

 

so my problem is like most peole

 

i get the mail from customer but there is no deatils about product or ID

 

i get all the deails from customer but not from produtcs

 

like that

----------------------------------------------------------------------------------------

kjvision has asked for information about the following product(s):

 

ID PRODUCT

 

 

 

Here is the contact information for kjvision

 

Phone: 01778888889999

Email Address: kjvision@kjvision.de

Mailing Address: kjvision

 

-----------------------------------------------------------

It is only in product.info

 

 

in shopping card it work great

 

i have the newest oscommerce .2.2.rc2 and php 5 and newest sql

 

 

can you help me ?

 

best wisches from germany

kjvision

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  

×