opencart

Adding a javascript to all pages in OpenCart

白昼怎懂夜的黑 提交于 2020-01-02 05:05:26
问题 I'm new to OpenCart and don't have any experience with PHP, so I have a question. I want to add the following JavaScript to hide the url bar on mobile browsers // When ready... window.addEventListener("load",function() { // Set a timeout... setTimeout(function(){ // Hide the address bar! window.scrollTo(0, 1); }, 0); }); However, I can't find a way to insert this so this code will be executed on all pages in OpenCart. Where should I put this code? 回答1: save your script to a file, say 'catalog

Adding a javascript to all pages in OpenCart

邮差的信 提交于 2020-01-02 05:04:07
问题 I'm new to OpenCart and don't have any experience with PHP, so I have a question. I want to add the following JavaScript to hide the url bar on mobile browsers // When ready... window.addEventListener("load",function() { // Set a timeout... setTimeout(function(){ // Hide the address bar! window.scrollTo(0, 1); }, 0); }); However, I can't find a way to insert this so this code will be executed on all pages in OpenCart. Where should I put this code? 回答1: save your script to a file, say 'catalog

How to find route of a current page?

▼魔方 西西 提交于 2020-01-02 03:02:13
问题 Is there a line of code that I can use in the controller that determines the route of a current page? For example, I would like to find the route of the page with SEO url https://example.com/desktops (this should return the route product/category ). Similarly, url such as https://example.com/index.php?route=product/product&path=18&product_id=47 should return route as product/product . 回答1: To be honest, the right answer is $this->request->get['route']; . In order to catch the current route,

Rewrite condition is not working

家住魔仙堡 提交于 2020-01-01 19:45:29
问题 How to rewrite the URL for my search page in opencart that is like http://IP/opencart/index.php?route=product/search&filter_name=24 But I need to display it like http://localhost/opencart/product/search/42 orelse in any formate that is an userfreindly.I have tried like RewriteEngine On RewriteBase /opencart RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %

Wrap a div around every four divs

跟風遠走 提交于 2020-01-01 09:52:01
问题 I need a little help with a php loop for OpenCart. I need to do is wrap a div around the output of the data every 4 loops. I have the following <?php foreach ($categories as $category) { ?> <div class="col-lg-3 col-md-3">.....</div> <?php } ?> I get this <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md

Wrap a div around every four divs

亡梦爱人 提交于 2020-01-01 09:51:11
问题 I need a little help with a php loop for OpenCart. I need to do is wrap a div around the output of the data every 4 loops. I have the following <?php foreach ($categories as $category) { ?> <div class="col-lg-3 col-md-3">.....</div> <?php } ?> I get this <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md-3">.....</div> <div class="col-lg-3 col-md

Best way to modify OpenCart without touching Core and VQMOD/OCMOD

我的未来我决定 提交于 2020-01-01 05:30:13
问题 Is there a better way then using VQMOD / OCMOD to change OpenCart's core files? Is there some "overrides" folder exists so that I can simply create any PHP file corresponding to the file structure and simply override a core file? (Like it is possible in PrestaShop and Magento ). VQMOD / OCMOD is highly inconvenient. Does someone use any hacks & tricks to achieve the result? I don't want to touch any core files to keep the system clean and manageable. Thanks a lot! 回答1: If you want to call

OpenCart load Model outside Controller

ぐ巨炮叔叔 提交于 2019-12-31 22:36:14
问题 I'm working on an OpenCart project, that requires a lot of customization. for my project I have to change something in the cart library (system/library/cart.php). I would have to call a custom function that's defined inside the product model (catalog/model/catalog/product.php). In a controller, loading a Model and using its functions is easy: $this->load->model("catalog/product"); $this->model_catalog_product->customFunction(); But how do you load a model outside a controller? You can't

Opencart add product options to opencart

心已入冬 提交于 2019-12-31 04:09:08
问题 My cart appears to be working except the product options. When I click add cart button then the item gets added, but no options are added with it. I really don't understand why this is happening as I have submitted the options as an array just as the function requires, using option_id and option_value_id JavaScript called when button is clicked $('#button-cart').on('click', function() { var model_select = $('#model option:selected').val(); alert("working"); $.ajax({ url: '<?php echo $action?>

Pav OpenCart 商城自适应主题模板 ABC-0006-03

人盡茶涼 提交于 2019-12-26 22:13:51
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 兼容浏览器 IE8, IE9, IE10, IE11, Firefox, Safari, Opera, Chrome OpenCart版本 OpenCart 1.5.6.x, OpenCart 1.5.5.x, OpenCart 1.5.5, OpenCart 1.5.4,OpenCart 2.0.x 包含文件 PHP Files, CSS Files, JS Files 详情地址 http://www.chinaopencart.cn/index.php?route=product/product&product_id=80 来源: oschina 链接: https://my.oschina.net/u/991572/blog/384479