bekatron Posted December 15, 2013 Posted December 15, 2013 Hello, A few weeks ago i added the module info box free shipping to my shop. This all working fine. Now i have the idea to add this information to the product page and the shopping cart so costumers see this info on all the pages. The module is this one and the code is: <?php /* $Id$ bm_free_shipping.php v1.0 15/11/2013 Ridexbuilder http://ejsolutions.co.uk osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ ?> <?php class bm_free_shipping { var $code = 'bm_free_shipping'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_free_shipping() { $this->title = MODULE_BOXES_FREE_SHIPPING_TITLE; $this->description = MODULE_BOXES_FREE_SHIPPING_DESCRIPTION; if ( defined('MODULE_BOXES_FREE_SHIPPING_STATUS') ) { $this->sort_order = MODULE_BOXES_FREE_SHIPPING_SORT_ORDER; $this->enabled = (MODULE_BOXES_FREE_SHIPPING_STATUS == 'True'); $this->group = ((MODULE_BOXES_FREE_SHIPPING_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right'); } } function execute() { global $cart, $currencies, $oscTemplate; $free_shipping_string = ''; if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') { $amount_to_spend = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total(); // // InfoBox styling can be done from here, preferably with classes and CSS - see top for embedded CSS // $free_shipping_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0" class="ui-widget-content infoBoxContents">'; $free_shipping_string .= '<tr><td><center>'; if ($cart->count_contents() == 0) { $free_shipping_string .= '<span class="fsDescription">'; $free_shipping_string .= MODULE_BOXES_FREE_SHIPPING_DESCRIPTION ; // $free_shipping_string .= . '<br>'; $free_shipping_string .= $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER); $free_shipping_string .= '</span>'; } else { if ($amount_to_spend > 0) { $free_shipping_string .= '<span class="fsSpend">'; $free_shipping_string .= MODULE_BOXES_FREE_SHIPPING_SPEND_1 . '<br />'; $free_shipping_string .= $currencies->format($amount_to_spend); $free_shipping_string .= '<br />' . MODULE_BOXES_FREE_SHIPPING_SPEND_2; $free_shipping_string .= '</span>'; } else { $free_shipping_string .= '<span class="freeShipping">'; $free_shipping_string .= MODULE_BOXES_FREE_SHIPPING_QUALIFIED . '<br />'; $free_shipping_string .= '</span>'; } } $free_shipping_string .= '<br /><span class="fsConditions">'; $free_shipping_string .= MODULE_BOXES_FREE_SHIPPING_CONDITIONS_1 . '<br />'; $free_shipping_string .= MODULE_BOXES_FREE_SHIPPING_CONDITIONS_2 . '<br />'; $free_shipping_string .= '</span>'; $free_shipping_string .= '</center></td></tr></table>'; //$data = '<div class="ui-widget infoBoxContainer">' . // '<div class="ui-widget-header infoBoxHeading"><span class="fsTitle">' . MODULE_BOXES_FREE_SHIPPING_TITLE . '</span></div>' . // $free_shipping_string . // '</div>'; $data = '<div class="ui-widget infoBoxContainer">' . '<div class="ui-widget-header infoBoxHeading"><span class="fsTitle">' . MODULE_BOXES_FREE_SHIPPING_TITLE . '</span></div>' . '<div class="ui-widget-content infoBoxContents">' . $free_shipping_string . '</div>'. '</div>'; $oscTemplate->addBlock($data, $this->group); } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_FREE_SHIPPING_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 Free Shipping Module', 'MODULE_BOXES_FREE_SHIPPING_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_FREE_SHIPPING_CONTENT_PLACEMENT', 'Left 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_FREE_SHIPPING_SORT_ORDER', '50', 'Sort order of display. Lowest is displayed first.', '6', '50', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_FREE_SHIPPING_STATUS', 'MODULE_BOXES_FREE_SHIPPING_CONTENT_PLACEMENT', 'MODULE_BOXES_FREE_SHIPPING_SORT_ORDER'); } } ?> Is it possible to add this info to this pages in a simple way?
♥kymation Posted December 15, 2013 Posted December 15, 2013 You could take all of the code inside the execute() method and just replace $oscTemplate->addBlock($data, $this->group); with echo $data; However, that will leave all of the old box styling, and that may not look very good. I would also remove all of the table tags and add some CSS styling. It's up to you how you want to use this. Regards Jim See my profile for a list of my addons and ways to get support.
bekatron Posted December 17, 2013 Author Posted December 17, 2013 Hello Jim, Thanks for your answer I'm gonna look at this. regards Bas
Recommended Posts
Archived
This topic is now archived and is closed to further replies.