Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Details = Technotes


Pica

Recommended Posts

I have been customizing OSC to my specific needs.

 

I have more than 15.000 items to put in it. Most of these have a technote with detailed information (motherboards, processors, hard-drives...).

 

For the time being I have replaced the "Click to enlarge" link below the product image to open a popup window with the specific "technote".

 

I managed to have it displayed dynamicaly with the product's image, reference, description...

 

My problem is when a product has NO technote... Seeing I use a INCLUDE line which adds a table with the specific technote, when there is none I have the product image, reference and description displayd correctly as

well as the bottom disclaimer message... BUT in the middle I get this error message saying it didn't find the specific technote table-file.

 

Is there a way to use a dummy or no-technote file included when it doesn't find a PHP file corresponding to the products reference?

 

Thanks in advance.

 

Paulo

Link to comment
Share on other sites

Hummm... interesting !!!

 

I just tried it and it worked ALMOST right !!! :?

 

Here's how I put it in the code :

 

If (include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php')) {

include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php');

} else {

include(DIR_WS_PROD_TECHNOTES . 'no_technote.php');

}

 

 

When I select a product which has its own technote, I get the Popup specific technote correctly.

 

When I select a product which has no technote, I get the Popup window with the product's name, picture, reference, description AND

 

1. an error message :

 

Warning: Failed opening 'technotes/058Y034.php' for inclusion

(include_path='.:/usr/local/php/lib/php')

in /usr/local/httpdocs/catalog/popup_details.php on line 94

 

2. I also get the contents of the desired no_technote.php block, which

is shown correctly.

 

That is almost perfect for my needs. If you know what's wrong in the code above, I'm all ears...

 

I don't know if this may be an interesting feature to others.

 

Thanks once more.

 

Paulo.

Link to comment
Share on other sites

If (include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php')) { 

     include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php'); 

} else { 

     include(DIR_WS_PROD_TECHNOTES . 'no_technote.php'); 

}

 

Try taking out the DIR_WS_PROD_TECHNOTES .

so it looks like this:

 

If (include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php')) { 

     include(DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php'); 

} else { 

     include('no_technote.php'); 

}

Link to comment
Share on other sites

HOURRA !!! :D

 

After fighting around with some PHP code ( I am not even a novice on this)

I finally got it working !!!

 

I just needed something to check if the specific file exists...

 

 

 

 

I use this in stead of the "Click To Enlarge" link. I created a copy of the initial popup file and called "popup_details.php".

 

This file is build on different blocks of code/text (in this order) :

 

1. the common technote header for all technotes

2. the specific product image taken from the "products_image"

3. the specific product description taken from the "products_description"

4. the specific product reference taken from "products_name"

 

5. the specific products technote from a separate file

 

6. the common footer disclqimer message

 

NB: in step "5." if the specific technote file does NOT exist, it picks a common empty technote.

 

VOILA !!!

 

Thanks for your hints on this matter.

 

Paulo. 8)

Link to comment
Share on other sites

It's better when I do not forget to put the code in my message... doooo!!! :roll:

 

Here it is :

 

 

<?php

 

if (file_exists (DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php'))

 

{ include (DIR_WS_PROD_TECHNOTES . $products_values['products_name'] . '.php'); }

 

else

 

{ include(DIR_WS_PROD_TECHNOTES . 'no_technote.php');}

 

?>

 

 

This is just the body of the popup_details.php which gets the technote block.

 

Paulo.

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