Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Make the image in product listing popup the image


Ylja

Recommended Posts

Posted

How can this be done? I would like the image to popup like in product_info.php when I click the image in the product listing.

 

Thanks!

Posted

In index.php copy this code to your head:

<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>

 

In includes/modules/product_listing.php find this code:

          case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break;

and replace it with this:

          case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = '
   <script language="javascript"><!--
   document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], addslashes($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>Click to enlarge</a>\');
   //--></script>
   <noscript>
   <a href="' . tep_href_link(DIR_WS_IMAGES . $listing['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>
   </noscript>';
           }
           break;

 

Enjoy!

 

Bobby

  • 3 months later...
Posted

This works great, but I have a problem. WHen I am listing products by using the Manufacturer infobox, the script does not work, ie, it acts as if I didnt even use the code. (No javascript)

 

When I navigate to the product list via Categories box, all is well.

 

Do you have any ideas for a workaround on this?

 

Thanks a bunch!

  • 2 weeks later...
Posted

I've the same problem (www.100asa.it)

and the text 'click to enlarge' don't change with languages.

Skype: centoasa

Skype: remigioruberto

Posted

and popup image don't work on advance search result page!

Skype: centoasa

Skype: remigioruberto

Posted

Probably because he only gave the code to change the index.php and the product_info.php not the whole site.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

Do you happen to know which file displays the results by the manufacturer so that I can add that code change to it?

 

I was under the impression it was product_listing.php but I guess I was wrong. :)

Posted

Oh nevermind, I figured it out.

 

Simply take out the if statement in products_listing.php and make it just the javascript.

 

Since Im not a PHP guru, this could cause problems in the long run, but it works! lol

  • 4 months later...
Posted

Does anyone have a better solution, or can explain how to make this work on the advanced search result file? Thanks.

Posted

Nevermind, I just had to add that first bit of code but fix one little problem with it. It shows & #39; where a ' is supposed to be. That code has to go on advanced_search_result.php then it works.

  • 1 month later...
Posted

hi

 

Just installed this, and I am having a problem with adding items to the cart from the popup.

 

Could it be because I have replaced manufacturer with product description as I have no manufacturers in my system

Born - Scotland

Location - Kent, England

Job - hunting for one

Posted

I followed the instruction to the letter, the only part I changed was, where you had manufacturer information to be displayed in the popup, I ut in the code to display the description instead.

 

The error I get when I click add to cart is as follows.

 

Line: 16

Char: 3

Error: 'opener.document.forms.cart_quantity' is null or not an object

Code: 0

URL: http://spottedhaggis.com/go4beads/popup_image.php?pID=4

 

Any ideas?....

Born - Scotland

Location - Kent, England

Job - hunting for one

  • 1 month later...
  • 5 months later...
Posted
I followed the instruction to the letter, the only part I changed was, where you had manufacturer information to be displayed in the popup, I ut in the code to display the description instead.

 

The error I get when I click add to cart is as follows.

 

Line: 16

Char: 3

Error: 'opener.document.forms.cart_quantity' is null or not an object

Code: 0

URL: http://spottedhaggis.com/go4beads/popup_image.php?pID=4

 

Any ideas?....

 

Nice Site!!

I am having the same problem making this work with columns. It looks like you never resolved it. :(

  • 1 year later...
  • 2 months later...
Posted

Update Fix.

 

"Index.php " and "advanced_search_result.php" <head>

 

<script language="javascript"><!--

function aleatorio(inferior,superior){
numPosibilidades = superior - inferior
aleat = Math.random() * numPosibilidades
aleat = Math.round(aleat)
return parseInt(inferior) + aleat
} 

function popupWindow(url) {
window.open(url,'popupWindow_'+aleatorio(1,200),'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re
sizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,l
eft=150')
}


//--></script>

 

 

It(He,She) allows to open more than one window, or the same one several times.

 

Sometimes the user does not give himself(herself) cuenda of that the this opened window, and it(he,she) does click and click.

 

He(She) corrects the failure(judgement) that on having looked for a product, with the seeker.

 

---

 

Permite abrir más de una ventana, o la misma varias veces.

 

a veces el usuario no se da cuenda de que la ventana esta abierta, y hace clic y clic.

 

Corrige el fallo que al buscar un producto, con el buscador.

 

More Info in OsCommerse Spanish - http://oscommerce.qadram.com

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...