Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

scroll best viewed for osCommerce 2.3


Diegosa

Recommended Posts

Hello,

 

I installed the contribution scroll best viewed for osCommerce 2.3.

 

But the images and text will come out of the box, have a side margin

left.

 

Ideas on how to fix it?

 

attached the code bm_best_viewed.php

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

class bm_best_viewed {

var $code = 'bm_best_viewed';

var $group = 'boxes';

var $title;

var $description;

var $sort_order;

var $enabled = false;

 

function bm_best_viewed() {

$this->title = MODULE_BOXES_BEST_VIEWED_TITLE;

$this->description = MODULE_BOXES_BEST_VIEWED_DESCRIPTION;

 

if ( defined('MODULE_BOXES_BEST_VIEWED_STATUS') ) {

$this->sort_order = MODULE_BOXES_BEST_VIEWED_SORT_ORDER;

$this->enabled = (MODULE_BOXES_BEST_VIEWED_STATUS == 'True');

 

$this->group = ((MODULE_BOXES_BEST_VIEWED_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');

}

}

 

function execute() {

global $HTTP_GET_VARS, $current_category_id, $languages_id, $oscTemplate, $currencies;

 

if (!isset($HTTP_GET_VARS['products_id'])) {

if (isset($current_category_id) && ($current_category_id > 0)) {

$best_viewed_query = tep_db_query("select distinct p.products_id, p.products_tax_class_id , s.specials_new_products_price, pd.products_name, pd.products_viewed, p.products_price, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s

on s.products_id = p.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by pd.products_viewed desc, pd.products_name limit " . MODULE_BOXES_BEST_VIEWED_MAX_DISPLAY);

} else {

$best_viewed_query = tep_db_query("select distinct p.products_id, p.products_tax_class_id , s.specials_new_products_price, pd.products_name, p.products_price, pd.products_viewed, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s

on s.products_id = p.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_viewed desc, pd.products_name limit " . MODULE_BOXES_BEST_VIEWED_MAX_DISPLAY);

}

 

if (tep_db_num_rows($best_viewed_query) >= MIN_DISPLAY_BESTSELLERS) {

 

 

$p_details = '' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'triangle-1-e', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) ). '';

 

$bestviewed_list = '<ol style="margin: 0;">';

while ($best_viewed = tep_db_fetch_array($best_viewed_query)) {

if (tep_not_null($best_viewed['specials_new_products_price'])) {

$best_viewed_price = '<del>' . $currencies->display_price($best_viewed['products_price'], tep_get_tax_rate($best_viewed['products_tax_class_id'])) . '</del><br />';

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

} else {

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

}

 

$p_details = '' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'search', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) , 'primary'). '';

 

 

 

$bestviewed_list .= '<li style="border-bottom:1px dotted #D3D3D3;text-align:center;margin-bottom:10px;" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) . '"><strong>' . $best_viewed['products_name'] . '</strong>' . tep_image(DIR_WS_IMAGES . $best_viewed['products_image'], $best_viewed['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><br />'. $best_viewed_price .'<br /><br />'.MODULE_BOXES_BEST_VIEWED_TEXT.':'.$best_viewed['products_viewed'].'<br /><br />' .$p_details. ' <br /><br /></li>';

}

$bestviewed_list .= '</ol>';

 

 

 

 

 

$data = '<div class="ui-widget infoBoxContainer">' .

' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_BEST_VIEWED_BOX_TITLE . '</div>' .

' <div class="ui-widget-content infoBoxContents"><MARQUEE behavior= "scroll" align= "center" direction= "up" width="160" height="3post-315150-0-16331700-1348797907_thumb.png00" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>' . $bestviewed_list . '</MARQUEE></div>' .

'</div>';

 

$oscTemplate->addBlock($data, $this->group);

}

}

}

 

function isEnabled() {

return $this->enabled;

}

 

function check() {

return defined('MODULE_BOXES_BEST_VIEWED_STATUS');

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Best vewed Module', 'MODULE_BOXES_BEST_VIEWED_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_BEST_VIEWED_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_BEST_VIEWED_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum products', 'MODULE_BOXES_BEST_VIEWED_MAX_DISPLAY', '10', 'Maximum products of display.', '6', '0', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

 

function keys() {

return array('MODULE_BOXES_BEST_VIEWED_STATUS', 'MODULE_BOXES_BEST_VIEWED_CONTENT_PLACEMENT', 'MODULE_BOXES_BEST_VIEWED_SORT_ORDER', 'MODULE_BOXES_BEST_VIEWED_MAX_DISPLAY');

}

}

?>

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I fixed it, deleting "ol" in line 50:

 

Before:

 

$bestviewed_list = '<ol style="margin: 0;">';

while ($best_viewed = tep_db_fetch_array($best_viewed_query)) {

if (tep_not_null($best_viewed['specials_new_products_price'])) {

$best_viewed_price = '<del>' . $currencies->display_price($best_viewed['products_price'], tep_get_tax_rate($best_viewed['products_tax_class_id'])) . '</del><br />';

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

} else {

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

}

 

$p_details = '' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'search', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) , 'primary'). '';

 

 

 

$bestviewed_list .= '<li style="border-bottom:1px dotted #D3D3D3;text-align:center;margin-bottom:10px;" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) . '"><strong>' . $best_viewed['products_name'] . '</strong>' . tep_image(DIR_WS_IMAGES . $best_viewed['products_image'], $best_viewed['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><br />'. $best_viewed_price .'<br /><br />'.MODULE_BOXES_BEST_VIEWED_TEXT.':'.$best_viewed['products_viewed'].'<br /><br />' .$p_details. ' <br /><br /></li>';

}

$bestviewed_list .= '</ol>';

 

After:

 

$bestviewed_list = '<style="margin: 0;">';

while ($best_viewed = tep_db_fetch_array($best_viewed_query)) {

if (tep_not_null($best_viewed['specials_new_products_price'])) {

$best_viewed_price = '<del>' . $currencies->display_price($best_viewed['products_price'], tep_get_tax_rate($best_viewed['products_tax_class_id'])) . '</del><br />';

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

} else {

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

}

 

$p_details = '' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'search', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) , 'primary'). '';

 

 

 

$bestviewed_list .= '<li style="border-bottom:1px dotted #D3D3D3;text-align:center;margin-bottom:10px;" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_viewed['products_id']) . '"><strong>' . $best_viewed['products_name'] . '</strong>' . tep_image(DIR_WS_IMAGES . $best_viewed['products_image'], $best_viewed['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><br />'. $best_viewed_price .'<br /><br />'.MODULE_BOXES_BEST_VIEWED_TEXT.':'.$best_viewed['products_viewed'].'<br /><br />' .$p_details. ' <br /><br /></li>';

}

$bestviewed_list .= '';

 

I hope it helps for you. :)

Greetings from Mexico. :thumbsup:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...