Jump to content

Papanco

Members
  • Content count

    17
  • Joined

  • Last visited

Posts posted by Papanco


  1. 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');
    ?>

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

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


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


  3. Hello Gianfranco,

     

    Please specify if you refer to rename the thumbnails or the original full size images.

    It would be also helpful to tell us which are your desired auto rename rules. For example: category name+correlative numbering or size in the case of thumbnails.

     

    If you refer to rename the original full size images, this is not the correct topic, nothing to do with image thumbnailer, you should open a newTopic.

     

    If you refer to the thumbnails, they were auto renamed adding the thumb size to the names in older version until version 20.

     

    Then in version 21 the subdirectory structure was added and the renaming removed.

    If you wish something like this, download version 20 and have a look on the coding in:

    includes/modules/kiss_image_thumbnailer/classes/Image_Helper.php

    line 70:

          $this->_thumb_filename = $this->attributes['width'] . 'x' . $this->attributes['height'] . '_' . $this->_image_name;
    

    and modify for your needs.

     

    regards

    Rainer

    Hello Rainer, thanks for the help: I want to rename the picture file with the name of the product (like contrib OPI images).

    currently I use version r22 on osc 234 Gold BS

    How can I do?

    Thank you

    Gianfranco

     


  4. As mentioned, it is the MySQL call. If you changed that and it didn't work, then the code needs to be altered. I haven't looked at it so I can't say what is required if that is needed at the moment.

    ok, solved!

    change in the file articles_xsell.hp the line 55 "$ fields = mysql_fetch_row ($ result_1)" in "$ fields = mysqli_fetch_row ($ result_1);"


  5. I can't test it because I don't have a server setup with 5.5 but that code is using mysql_fetch_row. For the latest oscommerce version it needs to be mysqli_fetch_row. It may not work since there isn't a link for it but give it a try.

    the problem is not the php 5.5 (I also tried with lower versions), but OSC version 2.3.3. and 2.3.4. any solution?

×