Jump to content
Latest News: (loading..)

vampirehunter

Members
  • Content count

    710
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by vampirehunter

  1. Ok, using Gergley's and Kymation's existing code and modifying and refining it slightly. I have managed to make the following module which hopefully is useful for people here: If anyone wants to try it out and check for any issues, that would be great. Any ideas for tweaking the code are also welcome, but this is a working module. A bootstrap carousel for the Home Page (Index Page) Only which will display any banners created from the Banner Manager in Admin. I've tested this, just 3 Files to install and just install via Admin, Modules and under Content. Its titled "Carousel Banners For Home Page" to make it easy to find. You can also set the content width of the carousel container which I've added in as a configuration option. So here are the files to insert: 1.) Includes/modules/content/header/cm_carousel.php <?php /* $Id: banner_rotator.php v1.1.2 20110108 Kymation $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class cm_carousel { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function cm_carousel() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_FRONT_PAGE_BANNER_ROTATOR_TITLE; $this->description = MODULE_FRONT_PAGE_BANNER_ROTATOR_DESCRIPTION; if (defined('MODULE_FRONT_PAGE_BANNER_ROTATOR_STATUS')) { $this->sort_order = MODULE_FRONT_PAGE_BANNER_ROTATOR_SORT_ORDER; $this->enabled = (MODULE_FRONT_PAGE_BANNER_ROTATOR_STATUS == 'True'); } } function execute() { global $PHP_SELF, $oscTemplate, $cPath; $content_width = (int)MODULE_FRONT_PAGE_BANNER_ROTATOR_CONTENT_WIDTH; if ($PHP_SELF == 'index.php' && $cPath == '') { // Set the Javascript to go in the header $footer_scripts = '<script>' . '$(\'.carousel\').carousel({ interval: ' . ( int ) MODULE_FRONT_PAGE_BANNER_ROTATOR_FADE_TIME . '})' . "\n" .'</script>'; $oscTemplate->addBlock($footer_scripts, 'footer_scripts'); // Set the banner rotator code to display on the front page $banner_query_raw = " select banners_id, banners_url, banners_image, banners_html_text from " . TABLE_BANNERS . " where banners_group = '" . MODULE_FRONT_PAGE_BANNER_ROTATOR_GROUP . "' and status order by banners_id " . MODULE_FRONT_PAGE_BANNER_ROTATOR_BANNER_ORDER . " limit " . MODULE_FRONT_PAGE_BANNER_ROTATOR_MAX_DISPLAY; $banner_query = tep_db_query($banner_query_raw); if (tep_db_num_rows($banner_query) > 0) { $body_text = '<!-- Banner Rotator BOF -->' . "\n"; $body_text .= ' <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">' . "\n"; $indicators = '<!-- Indicators --> <ol class="carousel-indicators">'; $wrapper_slides = '<!-- Wrapper for slides -->' . "\n" . '<div class="carousel-inner">'; $background = $this->createImage(544, 172, 118, 115, 115); $counter = 0; while ($banner = tep_db_fetch_array($banner_query)) { $indicators .= ' <li data-target="#carousel-example-generic" data-slide-to="' . $counter . '"' . ($counter == 0 ? 'class="active"' : '') . '></li>'; $wrapper_slides .= ' <div class="item' . ($counter == 0 ? ' active' : '') . '">'; if ($banner['banners_url'] != '') { $wrapper_slides .= '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '">'; } //$wrapper_slides .= tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_html_text']); if ($banner['banners_image'] !== '') { //$wrapper_slides .= tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_html_text']); $wrapper_slides .= tep_image(DIR_WS_IMAGES . $banner['banners_image'], '', 544, 172); $wrapper_slides .= '<div class="carousel-caption"> </div>'; } else { //$wrapper_slides .= tep_image(DIR_WS_IMAGES . 'pixel_silver.gif', 'alt', 544, 172 ); $wrapper_slides .= '<img class="img-responsive" alt="544x172" src="' . $background . '" />'; $wrapper_slides .= '<div class="carousel-caption">' . $banner['banners_html_text'] . '</div>'; } if ($banner['banners_url'] != '') { $wrapper_slides .= '</a>'; } $wrapper_slides .= ' </div>' . "\n"; $counter++; } $indicators .= '</ol>'; // close indicator $wrapper_slides .= '</div>'; // wrapper close $controls = ' <!-- Controls --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a>'; // öszefuzés $body_text .= $indicators . $wrapper_slides . $controls; $body_text .= ' </div>' . "\n"; $body_text .= ' <div class="clearfix"></div>' . "\n"; $body_text .= '<!-- Banner Rotator EOF -->' . "\n"; $carousel = $body_text; $oscTemplate->addBlock($carousel, $this->group); } ob_start(); include(DIR_WS_MODULES . 'content/' . $this->group . '/templates/carousel.php'); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_FRONT_PAGE_BANNER_ROTATOR_STATUS'); } function install() { 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_FRONT_PAGE_BANNER_ROTATOR_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, set_function, date_added) values ('Content Width', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', 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 ('Enable Banner Rotator', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_STATUS', 'True', 'Do you want to show the banner rotator?', '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, date_added) values ('Fade Time', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_FADE_TIME', '500', 'The time it takes to fade from one banner to the next. 1000 = 1 second', '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 ('Hold Time', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_HOLD_TIME', '4000', 'The time each banner is shown. 1000 = 1 second', '6', '0', 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 ('Banner Order', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_BANNER_ORDER', 'desc', 'Order that the Banner Rotator uses to show the banners.', '6', '0', 'tep_cfg_select_option(array(\'asc\', \'desc\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Banner Rotator Group', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_GROUP', 'rotator', 'Name of the banner group that the Banner Rotator uses to show the banners.', '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 ('Banner Rotator Max Banners', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_MAX_DISPLAY', '4', 'Maximum number of banners that the Banner Rotator will show', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array ( 'MODULE_FRONT_PAGE_BANNER_ROTATOR_CONTENT_WIDTH', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_STATUS', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_SORT_ORDER', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_FADE_TIME', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_HOLD_TIME', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_BANNER_ORDER', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_GROUP', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_MAX_DISPLAY' ); } function createImage($width = 900, $height = 500, $red = 255, $green = 0, $blue = 0) { $im = imagecreatetruecolor($width, $height); // sets background to red $color = imagecolorallocate($im, (int)$red, (int)$green, (int)$blue); imagefill($im, 0, 0, $color); //header('Content-type: image/png'); ob_start(); imagepng($im); $contents = ob_get_contents(); ob_end_clean(); imagedestroy($im); $imgData = base64_encode($contents); $src = 'data: image/png;base64,'.$imgData; return $src; } } ?> 2.) Includes/modules/content/header/templates/carousel.php <div id="carousel" class="col-sm-<?php echo $content_width; ?>"> <?php echo $carousel; ?> </div> 3.) Includes/languages/english/modules/content/header/cm_carousel.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ define('MODULE_FRONT_PAGE_BANNER_ROTATOR_TITLE', 'Carousel Banners For Home Page'); define('MODULE_FRONT_PAGE_BANNER_ROTATOR_DESCRIPTION', 'Adds a carousel to Home Page with banner images set from Banner Manager.'); ?> The only thing needed is to style your carousel in your user.css file by specifying whichever minimum heights you want or using bootstrap media queries for various screens. I've checked the code, and its working. Feel free to improve and offer any tips on this. Screenshot attached of the admin options and carousel on home page. I just used the stock oscommerce logo as a banner in this one.
  2. hi i was wondering if someone can advise. There is no guest checkout being used. Users have to sign up to purchase from the shop. I want to have an additional item or possibly attribute to only show up in the products listings when a specific other main item has been purchased. So for example, users can purchase the main item, but can only see the additional item after its been purchased and they are logged in. What is the simplest way to do it? So user logged in -> Can see Main Item Purchases Main Item. The additional item or alternatively items attributes then will show up in product listings whenever they are logged in.
  3. New Payflow requirement: TLS 1.2 & HTTP/1.1

    i ran the script and got this on my hosting PHP version: 5.4.45 curl version: 7.36.0 SSL version: OpenSSL/1.0.1e SSL version number: 0 OPENSSL_VERSION_NUMBER: 1000105f TLS test (default): TLS 1.2 TLS test (TLS_v1): TLS 1.2 TLS test (TLS_v1_2): TLS 1.2
  4. New Payflow requirement: TLS 1.2 & HTTP/1.1

    i have the paypal app installed on a edge/BS oscommerce im using paypal standard in the app I have configured my API using my paypal API username details and have a pdt token set. I dont have any information in the private key, public certificate or openssl fields in configure on the app. ive been able to accept payments. do i need to do anything in regards to this announcement?
  5. [CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

    whats the pros and cons of this addon vs the Ultimate SEO Urls for bootstrap version of oscommerce?
  6. PayPal App v5.000

    hi sorry if this sounds stupid, but if im using the Paypal App with my paypal api credentials. on the settings for paypal standard which im using ive set the PDT token but do i still require a public certificate, private key and openssl also?
  7. are these better suited to the Bootstrap versions than Gadlols SEO friendly url addon?
  8. AJAX Attribute Manager support

    Hi Does this plugin help to sort out the attributes easier than the default oscommerce? As in, you can sort attributes easily? and is it same as this one where you can add attributes when adding a new product for easier setup? https://apps.oscommerce.com/6E6Qw thanks
  9. PayPal App v5.010 for v2.3.4BS

    hi does encrypted payments have to be selected? i have set up api correctly but wondering if Encrypted payments should be selected to true?
  10. PayPal App v5.000

    hi i checked mine has no update button it just has button linking to the addon area would i need to manually add this addon myself?
  11. PayPal App v5.000

    can anyone advise. my paypal v4.039 i have currently can i just install the latest version of 5.010 drag and drop?
  12. PayPal App v5.010 for v2.3.4BS

    hi. my paypal app is currently 4.039 do i just install the latest version ontop of the existing one? or do i need to install each update first?
  13. PayPal App v5.000

    is it fairly easy to update the existing app to this newest version?
  14. I have made a quick easy addon for anyone interested. Please test it and leave any feedback if anything seems incorrect or wrongly coded. It simply adds a small bar with the current Shopping cart totals into the Header bar. You can resize it in Admin so it can sit nicely with the Shop Logo and the Search Bar (if you have those turned on). It resizes nicely in XS mobile view. Testing welcome, and any tips to improve is welcome. Instructions 1.) Copy and paste code below into a file called "cm_headercart.php" and place file into this location: "includes/modules/content/header/" <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ class cm_headercart { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function cm_headercart() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_HEADERCART_TITLE; $this->description = MODULE_CONTENT_HEADERCART_DESCRIPTION; if ( defined('MODULE_CONTENT_HEADERCART_STATUS') ) { $this->sort_order = MODULE_CONTENT_HEADERCART_SORT_ORDER; $this->enabled = (MODULE_CONTENT_HEADERCART_STATUS == 'True'); } } function execute() { global $PHP_SELF, $cart, $lng, $language, $currencies, $HTTP_GET_VARS, $request_type, $currency, $oscTemplate; $content_width = MODULE_CONTENT_HEADERCART_CONTENT_WIDTH; ob_start(); include(DIR_WS_MODULES . 'content/' . $this->group . '/templates/headercart.php'); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_HEADERCART_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Header Cart Module', 'MODULE_CONTENT_HEADERCART_STATUS', 'True', 'Do you want to enable the Header Cart content module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_HEADERCART_CONTENT_WIDTH', '4', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_HEADERCART_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_HEADERCART_STATUS', 'MODULE_CONTENT_HEADERCART_CONTENT_WIDTH', 'MODULE_CONTENT_HEADERCART_SORT_ORDER'); } } 2.) Copy and paste code below into a file called "headercart.php" and place file into this location: "includes/languages/english/modules/content/header/templates/" Feel free to change the div classes or layout to your preference. With this code, the cart total bar resizes nicely in XS View. <div class="col-sm-<?php echo $content_width; ?>"> <!-- Shopping Cart Starts --> <div class="searchbox-margin"> <div class="hidden-xs text-center-xs"> <a role="button" class="btn btn-info btn-block" href="<?php echo tep_href_link(FILENAME_SHOPPING_CART)?>"><i class="glyphicon glyphicon-shopping-cart"></i> <?php echo HEADERCART_TEXT . $cart->count_contents() . ' ' . HEADERCART_ITEMS . ' - ' . $currencies->format($cart->show_total()); ?></a> </div> </div> <div class="visible-xs text-center-xs"> <a role="button" class="btn btn-info btn-block" href="<?php echo tep_href_link(FILENAME_SHOPPING_CART)?>"><i class="glyphicon glyphicon-shopping-cart"></i> <?php echo $cart->count_contents() . ' ' . HEADERCART_ITEMS . ' - ' . $currencies->format($cart->show_total()); ?></a> </div> <div class="clearfix"></div> <br> <!-- Shopping Cart Ends --> </div> 3.) Copy and paste code below into a file called "cm_headercart.php" and place file into this location: "includes/languages/english/modules/content/header/" <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ define('MODULE_CONTENT_HEADERCART_TITLE', 'Header Cart'); define('MODULE_CONTENT_HEADERCART_DESCRIPTION', 'Adds Shopping Cart into the Header Area of your site.'); define('HEADERCART_TEXT', 'Cart: '); define('HEADERCART_ITEMS', 'Item(s) '); 4.) Add to "user.css" file. I put this to move the bar slightly down so it centers with the shop logo and also used this same class and outer div on the searchbox module template so they line up nicely. You can remove or change these if you are doing your own layout. .searchbox-margin { margin-top: 10px; margin-bottom: 10px; }
  15. I think best way if you have no other module alongside it on the same line. Its to add a variable that will add alignment to the module. In bootstrap the pull-right or pull-left is what aligns. <div class="col-sm-4 pull-right"> ill see if i can edit the code to add this variable at the moment the code is just specifying the column width of the module so we just need to add an extra variable for setting the alignment I think. <div class="col-sm-<?php echo $content_width; ?>">
  16. good question, i didn't really look at it when i did it, but I think maybe just doing it in the div tag in the html template of the module? or it maybe be a case of adding a variable to the code for alignment. in the admin you can select the content width from 1 to 12. in mine ive set the shop logo, then search bar, then the cart total bar modules seperately in one line, so each is set to content width 4, so i haven't needed to set an alignment. I just use the Sort order to put each one i want first before the other. If you have just the cart total bar and nothing else on the same line, then I think you should be able to do it with CSS. can someone verify?
  17. QTPro BS

    is there any screenshots of this?
  18. whats performance like with the jssor vs the standard bootstrap carousel?
  19. Google XML Sitemap SEO

    is robots.txt important alongside google sitemaps? is there any link to tutorial. im not sure on what robots.txt to use for oscommerce
  20. State Selector for BS

    hi thanks ive tried everything. whenever i click save in admin, just goes to a 403 blank page i even installed this newer plugin, country states bs 2.4.2 and even that gives the same problem. all other plugins i have work fine. seems like a javascript issue although im not sure what. why in admin its not saving the updates to the module? it doesn't make sense
  21. State Selector for BS

    hi i installed this, but in admin, when you try and select which pages for it to show on, and click save, it just goes to a blank page.
  22. Purchase without account for 2.3.4 and BS2334

    does anyone where to find this bit of code here? <span class="fa fa-chevron-right"></span> I want to change that class to fa-angle-right but cant find this anywhere. its for the guest login button on login form its ok, i found it thanks
×