Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi

I installed the contribution show_random and I believe that I have followed allthe instructions correct, twice now, but my heading is showing as

 

BOX_HEADING_SHOW_RANDOM instead of the title.

 

Below is a snippet from my includes/languages/english.php

 

// whats_new box text in includes/boxes/whats_new.php

define('BOX_HEADING_WHATS_NEW', 'What\'s New?');

 

// show_random box text in includes/boxes/show_random.php

define('BOX_HEADING_SHOW_RANDOM', 'Spotlight');

 

// quick_find box text in includes/boxes/quick_find.php

define('BOX_HEADING_SEARCH', 'Search');

define('BOX_SEARCH_TEXT', '');

define('BOX_SEARCH_ADVANCED_SEARCH', 'Advanced Search');

 

 

Its the middle one above. I dont see what is different - why would it not say 'Spotlight' could I be missing something somewhere else?

The webpage I am setting the catalog up on is http://www.sheepieshop.com/catalog/

The random box is showing up ok on my page but the title isnt . I am concerned as the contribution is from 2002....

 

Can someone point me in the right direction to fix this please?

Posted

Your first suspicion is correct: this contribution is obsoleted due to a change in whats_new.php.

 

The contribution is a modification to whats_new.php v1.30, and the current version is v1.31.

 

The difference causing your problem is that the infobox_box_contents array no longer has the text alignment in it, so this

$info_box_contents[] = array('align' => 'left',
                                'text'  => 'BOX_HEADING_SHOW_RANDOM'

should be

$info_box_contents[] = array('text' => 'BOX_HEADING_SHOW_RANDOM'

Posted

Thanks very much for your reply,

 

There were 2 instances of the location in the show_random.php as you described and so I removed "the location reference' from both of them.

 

Unfortunately, the title has still not appeared correctly ( or any different than before) Below is my show_random.php - can you see anything else that may be affecting it? If not, I guess I will just remove this contribution, but it is what I wanted and I cant see a newer one.

 

  show_random.php: entirely based on

  $Id: whats_new.php,v 1.30 2002/06/05 20:59:08 dgw_ Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2002 osCommerce

 

  Released under the GNU General Public License

*/

?>

<!-- show_random //-->

          <tr>

            <td>

<?php

  if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' limit " . MAX_RANDOM_SELECT_NEW)) {

    $random_product['products_name'] = tep_get_products_name($random_product['products_id']);

    $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

 

    $info_box_contents = array();

    $info_box_contents[] = array('text' => 'BOX_HEADING_SHOW_RANDOM'

                                );

    new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'));

 

    if ($random_product['specials_new_products_price']) {

      $rprod_price =  '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';

      $rprod_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';

    } else {

      $rprod_price =  $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));

    }

 

    $info_box_contents = array();

    $info_box_contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . $random_product['products_name'] . '</a><br>' . $rprod_price

                                );

    new infoBox($info_box_contents);

  }

?>

            </td>

          </tr>

<!-- show_random_eof //-->

 

Thanks again for your help,

Posted

Comparing the original whats_new.php v1.30 with the contribution mod, I find only three differences: the "order by" clause is removed from the database search, the name of the box heading is changed, and local variable $whats_new_price is renamed $rprod_price.

 

So, the following is whats_new.php v1.31 with the same changes:

<?php
/* show_random.php: entirely based on
 $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1'  limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- show_random //-->
         <tr>
           <td>
<?php
   $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
   $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_SHOW RANDOM);

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

   if (tep_not_null($random_product['specials_new_products_price'])) {
     $rprod_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
     $rprod_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
   } else {
     $rprod_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
   }

   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'center',
                                'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $rprod_price);

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- show_random_eof //-->
<?php
 }
?>

Posted

Thanks,

 

I can not get it to work, so I am going to remove the contribution. It is telling me

 

Parse error: parse error, unexpected T_STRING, expecting ')' in /usr/local/psa/home/vhosts/sheepieshop.com/httpdocs/catalog/includes/boxes/show_random.php on line 23

 

and I just dont know enough yet to be able to fix it. Thanks again for your help - it was very kind of you.

Posted

I must be defined without ' .

 

    $info_box_contents[] = array('align' => 'left',
                                'text'  => BOX_HEADING_SHOW_RANDOM
                               );

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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