Jump to content
Parikesit

[Contribution] OPI: OsC Product Image Module

Recommended Posts

@@raiwa

 

Should it not plug over a fresh install of 2.3.3.3? The instructions are pretty cut and dry. Copy all of advanced.htaccess to the htaccess in the root directory. I removed every htaccess from the entire store except that one so as not to conflict. Overwrite files and append your chosen define to all tep_image references. I could get images loaded to the products subdirectory but not display them. Nothing happens with (_thumbnails_) folder what so ever and the front end images are a never ending spinner.

 

Also, on the frontend, if ModReqwrite is off and your only appending /def/small/whatever/ to the tep_image() references, then how  would any of those image calls know that opi_thumbnailer.php is the image handler without a modification to the tep_image() function in html_output.php. Correct me if im wrong, but im understanding it does rely on the native tep_image function.

 

The only way i could get it to work was buy turning off modRewrite and letting the opi.thumnailer handle the images. Even then, couldnt get them to show up on the front end because the tep_image function doesnt see a /def/small/whatever directory.

I'm at a loss, and really don't know where to go from here. Any direction would be helpful.

Share this post


Link to post
Share on other sites

Dear Bo @@badbo,

 

This has nothing to do with OPI. OPI modifications and script do not interfere in the image size information. Otherwise everything related to your image thumbnail problems has been pointed out in the kissIT thread.

 

Kindest regards

Rainer

Rainer I cured my problem with:

tep_image(DIR_WS_IMAGES . 'thumbs/def/small/' . $specials['products_image'], $specials['products_name'], '80', '80');

adding the image sizes where I needed them. Thanks

Share this post


Link to post
Share on other sites

@@raiwa

 

Should it not plug over a fresh install of 2.3.3.3? The instructions are pretty cut and dry. Copy all of advanced.htaccess to the htaccess in the root directory. I removed every htaccess from the entire store except that one so as not to conflict. Overwrite files and append your chosen define to all tep_image references. I could get images loaded to the products subdirectory but not display them. Nothing happens with (_thumbnails_) folder what so ever and the front end images are a never ending spinner.

 

Also, on the frontend, if ModReqwrite is off and your only appending /def/small/whatever/ to the tep_image() references, then how  would any of those image calls know that opi_thumbnailer.php is the image handler without a modification to the tep_image() function in html_output.php. Correct me if im wrong, but im understanding it does rely on the native tep_image function.

 

The only way i could get it to work was buy turning off modRewrite and letting the opi.thumnailer handle the images. Even then, couldnt get them to show up on the front end because the tep_image function doesnt see a /def/small/whatever directory.

I'm at a loss, and really don't know where to go from here. Any direction would be helpful.

Most of the time it is because of your admin settings. Somewhere i saw in this forum that advanced htaccess was for https not http, but i could be wrong. I bet if you post your admin settings and your server info that Rainer will help you. Are you using windows or whatever.

Share this post


Link to post
Share on other sites

Maybe im missing a configuration value in opi_thumbnail.php. So my server has many folders within the root with many domains and sites linked to each one. for this site its folder is called test_site. The opi: absolute path within the admin configuration table is

 

 

/....ges/1/.....345166/htdocs/test_site/images/

 

 

//deprecated after modrewrite setting is very confusing.

//NO APACHE REWRITE, remove/commented below line
if (basename($_SERVER['REQUEST_URI']) == basename(__FILE__)) imageScale404(); //preventing direct access to this file

//disable custom mode: crop,auto,clip,width and height request
define('OPI_ENABLE_CUSTOME_MODE', false); //if you disabled it, also edit .htaccess and remove rewriteRule that command customMode

define('OPI_ENABLE_ADVANCED_REWRITE', true);  //deprecated

define('OPI_DISABLE_UPSIZE', true);  // auto or prop mode required - if original image is smaller than required thumbnail, do not upsize -  white background will be added to reach requested size and image centered

define('DIR_FS_OPIFILE_HERE', dirname(__FILE__));                               // absolute path to this file
define('OPI_FS_CHMOD', 0755);  // some servers required 0775 or 0777
define('OPI_FS_IMAGES_OPI_PATH', DIR_FS_OPIFILE_HERE . str_replace('/', DIRECTORY_SEPARATOR, '/'.DIR_WS_IMAGES) );             // OSC_PRODUCT_IMAGE_ABSOLUTE_PATH
define('OPI_FS_IMAGES_OPI_THUMB', OPI_FS_IMAGES_OPI_PATH . str_replace('/', DIRECTORY_SEPARATOR, '_thumbnail_/'));      // OSC_PRODUCT_IMAGE_ABSOLUTE_PATH + OSC_PRODUCT_IMAGE_THUMBNAIL_DIRECTORY
define('OPI_FS_IMAGES_WATERMARK', OPI_FS_IMAGES_OPI_PATH . str_replace('/', DIRECTORY_SEPARATOR, '_hidden_/watermarked.png') );  // watermark file

Share this post


Link to post
Share on other sites

Maybe im missing a configuration value in opi_thumbnail.php. So my server has many folders within the root with many domains and sites linked to each one. for this site its folder is called test_site. The opi: absolute path within the admin configuration table is

 

 

/....ges/1/.....345166/htdocs/test_site/images/

 

With ModRewrite enabled, when viewing source on the front end of products_info.php

<div id="piGal" style="float: right;">
<a href="http://myswebsite.com/images/thumbs/def/large/matrox/mg200mms.gif" target="_blank" rel="fancybox"><img src="images/thumbs/def/display/matrox/mg200mms.gif" alt="Matrox G200 MMS" title="Matrox G200 MMS" hspace="5" vspace="5" /></a> </div>

when viewing source on admin side

var oscProductImageHelper = {
sessionLife: 1440000,
cleanup: false,
ajaxURL: 'http://subdomain.mywebsite.com/ceo/opi_productimage.php',
imageURL: {path:'http://subdomain.mywebsite.com/images/', relative:'products/', medium:'http://subdomain.mywebsite.com/images/thumbs/def/adminpreview/', small:'http://subdomain.mywebsite.com/images/thumbs/def/adminthumb/', transparent:'images/pixel_trans.gif'},
privileges: {directory:1,deletes:1},
language_id:'1',
products_images: 'gt_interactive/unreal_tournament.gif,products/unreal-tournament.png',

opi_thumnails.php settings

//NO APACHE REWRITE, remove/commented below line
if (basename($_SERVER['REQUEST_URI']) == basename(__FILE__)) imageScale404(); //preventing direct access to this file

//disable custom mode: crop,auto,clip,width and height request
define('OPI_ENABLE_CUSTOME_MODE', false); //if you disabled it, also edit .htaccess and remove rewriteRule that command customMode

define('OPI_ENABLE_ADVANCED_REWRITE', true); //deprecated

define('OPI_DISABLE_UPSIZE', true); // auto or prop mode required - if original image is smaller than required thumbnail, do not upsize - white background will be added to reach requested size and image centered

define('DIR_FS_OPIFILE_HERE', dirname(__FILE__)); // absolute path to this file
define('OPI_FS_CHMOD', 0755); // some servers required 0775 or 0777
define('OPI_FS_IMAGES_OPI_PATH', DIR_FS_OPIFILE_HERE . str_replace('/', DIRECTORY_SEPARATOR, '/'.DIR_WS_IMAGES) ); // OSC_PRODUCT_IMAGE_ABSOLUTE_PATH
define('OPI_FS_IMAGES_OPI_THUMB', OPI_FS_IMAGES_OPI_PATH . str_replace('/', DIRECTORY_SEPARATOR, '_thumbnail_/')); // OSC_PRODUCT_IMAGE_ABSOLUTE_PATH + OSC_PRODUCT_IMAGE_THUMBNAIL_DIRECTORY
define('OPI_FS_IMAGES_WATERMARK', OPI_FS_IMAGES_OPI_PATH . str_replace('/', DIRECTORY_SEPARATOR, '_hidden_/watermarked.png') ); 

Share this post


Link to post
Share on other sites

Hello Eric @@breakbred101,

 

First to say that I'm not the original author of the contribution. I only added the "prop" image mode to version 2.1.

I also used and tested it for ios mobile and 2.3.4 BS. I installed the image upload and manage features in admin categories.php only once some years ago and didn't find it useful (don't remember if it worked out of the box or needed fixes).

So all my experience is only for the thumbnail generating part.

 

The only important modification in admin/categories.php to get it to work is to include that line:

  require(DIR_WS_CLASSES . 'productImageHandler.php');

at the beginning below:

  require(DIR_WS_CLASSES . 'currencies.php');
  $currencies = new currencies();

Then you need to open at least once the admin/categories.php page to execute the database modifications.

Make also sure that the thumbnail folders are writeable.

 

I have it running on my local test environment under windows 8 and PHP5.2 and on the server under unix and PHP 5.2 on several stores without any problem with the included .htaccess modifications.

I'll test it soon under PHP 5.3 and 5.4.

 

The tep_image function doesn't need any modification and the thumbnails are called by the image path modifications.

It is one of the big advantages facing other thumbnail generators.

1. it works also with standard html image tags: <img src=".... instead of tep_image function.

2. It doesn't need numeric image size definition. This is used in iosc mobile for responsive product images.

 

kindest regards

Rainer

Share this post


Link to post
Share on other sites

I am using osc 2.3.4. Just I installe OPI-2.1. Iam using some other add_ons. So i eited amin/categories.php as pe the instruction given by the auther. But I get problem s when loading image in add new prouct. The error massage is...

 

Error: Directory does not exist. :: 
Go to Configuration > Images > OPI: Relative Directory to edit default directory.

 

I hve a folder "proucts" in images folder. and set OPI: Relative Directory -(value) products.

 

why can't I uploade images? Please help me any one.

Share this post


Link to post
Share on other sites

Honest review - This is a pretty terrible module.  Installation instructions are backwards, they don't specify clearly what to edit and where, edited files are not commented nor are they correct.  I strongly suggest others to try another method.

 

This module is NOT bootstrap compatible.  For one, this module relies on a new field in the products database called "products_images" but, the included product_info.php does not use this field.  The "patch" for this has been copied and pasted into this thread, but is not part of the package, and the copy-pasting is not accurate either.  Moreover, the point of the bootstrap system was so that users could easily plug in new modules and remove them as needed.  This module was not re-written for this - you cannot add/remove this via the configuration pages.  

Share this post


Link to post
Share on other sites

@@cdetdi,

 

I never claimed that it is rewritten for BS an i know that the instructions are old and not the best.

 

It works with BS because it doesn't need any modification for all images except the product image in product_info.php

In version 2.1 it says: "- 2.3.4 BS tested"

In version 2.2 it says: "Added support for osc2.3.4 and 2.3.4BS colorbox/photoset-grid thumbnail"

 

IT IS BS compatible.

Another issue is the image upload part which has been clarified in a post before.

 

But, if you can do it better, please go ahead.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@cdetdi,

 

for the edited BS product_info.php file:

You may consider that there is no official BS release, so the exact coding may vary since the begin of BS develop last summer.

Once the official 2.4 version is released it will be for sure easier to be accurate and also make more sense to spent the time to update this add-on and others to real BS versions.

Share this post


Link to post
Share on other sites

Hi guys!
I have osCommerce 2.3.4BS Gold, PHP5.4, IIS8.5
I installed OPI: Another OsC Product Image Module Vers. 2.2.
Almost everything works, but there is a problem: I can not select a folder to load images.
The modal window I want to select the folder /mans, but the script does not choose, and always returns the "Select".
And of course, all images are downloaded to the folder /products, but not in folder /mans.

Can you help fix this?
Thank you!

post-57268-0-39626300-1441178431_thumb.png


No outside url's in signatures allowed - thanks

Share this post


Link to post
Share on other sites

@@spidometrs,

 

sorry I do not give support for this part of the add-on, only for the thumbnail generator part.

Share this post


Link to post
Share on other sites

I have a problem with 2.3.4 BS Gold: Do not load thumbnails in product_info
any suggestions?
Thank you.

Gianfranco

Share this post


Link to post
Share on other sites

Hello Gianfranco @@Papanco,

 

Could you please post the image path shown in image info if you right click on the image link. Also do you refer to the small images or the big image in the pop up window??

Share this post


Link to post
Share on other sites

Hello Gianfranco @@Papanco,

 

Could you please post the image path shown in image info if you right click on the image link. Also do you refer to the small images or the big image in the pop up window??

link product: www. vacanzaebenessere .com/product_info.php?cPath=1_4&products_id=1

link admin categories: www. vacanzaebenessere .com/admin.jpg

Thank's

Share this post


Link to post
Share on other sites

@@Papanco,

 

It looks all correct to me.

Image shows and its thumbnail on the product page (small image9 and original full size image on the popup.

Image path is:

http://www.vacanzaebenessere.com/images/thumbs/def/display1/products/matrox-g200-mms-1.png

and

http://www.vacanzaebenessere.com/images/products/matrox-g200-mms-1.png

 

Or do I miss something??

Share this post


Link to post
Share on other sites

@@raiwa

missing thumbnails and link in the popup of other images that you can view the page categories.
that is the question!

Share this post


Link to post
Share on other sites

@@Papanco,

 

It looks like a problem with the admin image upload part. I do not give support for that part, I do not use it. You should first try to add images with the unmodified admin/categories.php file and check if images show then in product_info.php. Probably they do not upload/enter correct in the database.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

the website created is a test version with the original files.
admin access standard (if you try)
I loaded the file "OPI" without changes

Share this post


Link to post
Share on other sites

@@Papanco,

 

The admin image you posted (www. vacanzaebenessere .com/admin.jpg) shows the opi modified categories.php, try the original 2.3.4 bootstrap, load up the additional images and check if they show correct in product_info.php.

If they show then correct, it's a problem of the image upload part in admin/categories.php. I DO NOT give support for that part, Sorry!

 

In any case it is impossible to say where is the exact error, access to your admin and database would be needed.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@Papanco,

 

The admin image you posted (www. vacanzaebenessere .com/admin.jpg) shows the opi modified categories.php, try the original 2.3.4 bootstrap, load up the additional images and check if they show correct in product_info.php.

If they show then correct, it's a problem of the image upload part in admin/categories.php. I DO NOT give support for that part, Sorry!

 

In any case it is impossible to say where is the exact error, access to your admin and database would be needed.

the additional images are inserted correctly into the database and into their respective folders but not seen in product_info

Share this post


Link to post
Share on other sites

@@Papanco,

 

This is quite difficult to understand, the only modifications in product info are adding the opi image path. If it works with the main image it must work with the thumbnails. Can you try with the original product_info.php and if it works, post your original and modified product_info.php.

Share this post


Link to post
Share on other sites

Original product_info:

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
 
    if (tep_not_null($product_info['products_model'])) {
      $products_name .= '<br /><small>[<span itemprop=model">' . $product_info['products_model] . '</span>]</small>';
    }
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')). 'action=add_product', 'NONSSL'), 'post', 'class="form-horizontal" role="form"'); ?>

<div itemscope itemtype="http://schema.org/Product">

<div class="page-header">
  <h1 class="pull-right" itemprop="offers" itemscope itemtype="
http://schema.org/Offer"><?phpecho $products_price; ?></h1>
  <h1><?php echo $products_name; ?></h1>
</div>

<?php
  if ($messageStack->size('product_action') > 0) {
    echo $messageStack->output('product_action');
  }
?>

<div class="contentContainer">
  <div class="contentText">

<?php
    if (tep_not_null($product_info['products_image'])) {

      echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], NULL, NULL, NULL, 'itemprop="image" style="display:none;"');

      $photoset_layout = '1';

      $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
      $pi_total = tep_db_num_rows($pi_query);

      if ($pi_total > 0) {
        $pi_sub = $pi_total-1;

        while ($pi_sub > 5) {
          $photoset_layout .= 5;
          $pi_sub = $pi_sub-5;
        }

        if ($pi_sub > 0) {
          $photoset_layout .= ($pi_total > 5) ? 5 : $pi_sub;
        }
?>

    <div id="piGal" data-imgcount="<?php echo $photoset_layout; ?>">

<?php
        $pi_counter = 0;
        $pi_html = array();

        while ($pi = tep_db_fetch_array($pi_query)) {
          $pi_counter++;

          if (tep_not_null($pi['htmlcontent'])) {
            $pi_html[] = '<div id="piGalDiv_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div>';
          }

          echo tep_image(DIR_WS_IMAGES . $pi['image'], '', '', '', 'id="piGalImg_' . $pi_counter . '"');
        }
?>

    </div>

<?php
        if ( !empty($pi_html) ) {
          echo '    <div style="display: none;">' . implode('', $pi_html) . '</div>';
        }
      } else {
?>

    <div id="piGal">
      <?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])); ?>
    </div>

<?php
      }
    }
?>

<div itemprop="description">
  <?php echo stripslashes($product_info['products_description']); ?>
</div>

<?php
    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
?>

    <h4><?php echo TEXT_PRODUCT_OPTIONS; ?></h4>

    <p>
<?php
      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
          }
        }

        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
?>
      <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, 'style="width: 200px;"'); ?><br />
<?php
      }
?>
    </p>

<?php
    }
?>

    <div class="clearfix"></div>

<?php
    if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>

    <div class="alert alert-info"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></div>

<?php
    }
?>

  </div>

<?php
    $reviews_query = tep_db_query("select count(*) as count, avg(reviews_rating) as avgrating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
    $reviews = tep_db_fetch_array($reviews_query);

    if ($reviews['count'] > 0) {
      echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><metaitemprop="ratingValue" content="' . $reviews['avgrating'] . '" /><meta itemprop="ratingCount" content="' . $reviews['count'] . '" /></span>';
    }
?>

  <div class="buttonSet row">
    <div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'glyphicon glyphicon-comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?></div>
    <div class="col-xs-6 text-right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'glyphicon glyphicon-shopping-cart', null, 'primary', null, 'btn-success'); ?></div>
  </div>

  <div class="row">
    <?php echo $oscTemplate->getContent('product_info'); ?>
  </div>

<?php
    if ((USE_CACHE == 'true') && empty($SID)) {
      echo tep_cache_also_purchased(3600);
    } else {
      include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
    }

    if ($product_info['manufacturers_id'] > 0) {
      $manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$product_info['manufacturers_id'] . "'");
      if (tep_db_num_rows($manufacturer_query)) {
        $manufacturer = tep_db_fetch_array($manufacturer_query);
        echo '<span itemprop="manufacturer" itemscope itemtype="http://schema.org/Organization"><metaitemprop="name" content="' . tep_output_string($manufacturer['manufacturers_name']) . '" /></span>';
      }
    }
?>

</div>

</div>

</form>

<?php
  }
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

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

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

modified product_info

 

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
 
    if (tep_not_null($product_info['products_model'])) {
      $products_name .= '<br /><small>[<span itemprop=model">' . $product_info['products_model] . '</span>]</small>';
    }
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')). 'action=add_product', 'NONSSL'), 'post', 'class="form-horizontal" role="form"'); ?>

<div itemscope itemtype="http://schema.org/Product">

<div class="page-header">
  <h1 class="pull-right" itemprop="offers" itemscope itemtype="
http://schema.org/Offer"><?phpecho $products_price; ?></h1>
  <h1><?php echo $products_name; ?></h1>
</div>

<?php
  if ($messageStack->size('product_action') > 0) {
    echo $messageStack->output('product_action');
  }
?>

<div class="contentContainer">
  <div class="contentText">

<?php
    if (tep_not_null($product_info['products_image'])) {

      // OPI edited
      echo tep_image(DIR_WS_IMAGES . 'thumbs/def/display/' . $product_info['products_image'], NULL, NULL, NULL, 'itemprop="image" style="display:none;"');

      $photoset_layout = '1';

      $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
      $pi_total = tep_db_num_rows($pi_query);

      if ($pi_total > 0) {
        $pi_sub = $pi_total-1;

        while ($pi_sub > 5) {
          $photoset_layout .= 5;
          $pi_sub = $pi_sub-5;
        }

        if ($pi_sub > 0) {
          $photoset_layout .= ($pi_total > 5) ? 5 : $pi_sub;
          // OPI edited
          $opi_thumb = 'thumbs/def/display' . (($pi_total > 5) ? '5' : $pi_sub) . '/';
        }
?>

    <div id="piGal" data-imgcount="<?php echo $photoset_layout; ?>">

<?php
        $pi_counter = 0;
        $pi_html = array();

        while ($pi = tep_db_fetch_array($pi_query)) {
          $pi_counter++;

          if (tep_not_null($pi['htmlcontent'])) {
            $pi_html[] = '<div id="piGalDiv_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div>';
          }

          // OPI edited
          echo tep_image(DIR_WS_IMAGES . (($pi_counter > 1)? $opi_thumb : 'thumbs/def/display1/') . $pi['image'], '', '', '', 'id="piGalImg_' . $pi_counter . '" data-highres="'. DIR_WS_IMAGES . $pi['image'] .'"');
        }
?>

    </div>

<?php
        if ( !empty($pi_html) ) {
          echo '    <div style="display: none;">' . implode('', $pi_html) . '</div>';
        }
      } else {
?>

    <div id="piGal">
      <?php
      // OPI edited
      echo tep_image(DIR_WS_IMAGES . 'thumbs/def/display1/' . $product_info['products_image'], addslashes($product_info['products_name']), '', '', 'id="piGalImg_' . $pi_counter . '" data-highres="'. DIR_WS_IMAGES . $product_info['products_image'] .'"');
      ?>
    </div>

<?php
      }
    }
?>

<div itemprop="description">
  <?php echo stripslashes($product_info['products_description']); ?>
</div>

<?php
    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
?>

    <h4><?php echo TEXT_PRODUCT_OPTIONS; ?></h4>

    <p>
<?php
      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
          }
        }

        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
?>
      <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, 'style="width: 200px;"'); ?><br />
<?php
      }
?>
    </p>

<?php
    }
?>

    <div class="clearfix"></div>

<?php
    if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>

    <div class="alert alert-info"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></div>

<?php
    }
?>

  </div>

<?php
    $reviews_query = tep_db_query("select count(*) as count, avg(reviews_rating) as avgrating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
    $reviews = tep_db_fetch_array($reviews_query);

    if ($reviews['count'] > 0) {
      echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><metaitemprop="ratingValue" content="' . $reviews['avgrating'] . '" /><meta itemprop="ratingCount" content="' . $reviews['count'] . '" /></span>';
    }
?>

  <div class="buttonSet row">
    <div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'glyphicon glyphicon-comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?></div>
    <div class="col-xs-6 text-right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'glyphicon glyphicon-shopping-cart', null, 'primary', null, 'btn-success'); ?></div>
  </div>

  <div class="row">
    <?php echo $oscTemplate->getContent('product_info'); ?>
  </div>

<?php
    if ((USE_CACHE == 'true') && empty($SID)) {
      echo tep_cache_also_purchased(3600);
    } else {
      include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
    }

    if ($product_info['manufacturers_id'] > 0) {
      $manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$product_info['manufacturers_id'] . "'");
      if (tep_db_num_rows($manufacturer_query)) {
        $manufacturer = tep_db_fetch_array($manufacturer_query);
        echo '<span itemprop="manufacturer" itemscope itemtype="http://schema.org/Organization"><metaitemprop="name" content="' . tep_output_string($manufacturer['manufacturers_name']) . '" /></span>';
      }
    }
?>

</div>

</div>

</form>

<?php
  }
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

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

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

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

×