Change layout products in orocommerce - orocommerce

I have a problem with storefont customization,I created custom bundle create bundle and my firs theme create custom theme,my website run in locahost enviroment dev,I changed scss in file embedded-products-config.scss:
$embedded-products-item-count-desktop: 4 !default;
to
$embedded-products-item-count-desktop: 6 !default;
but when I run css not overide when loading it shows 6 products about 2 seconds and return 4 products immediately.

You probably already solved this but I would recommend updating the featured product record limit in the back office.
Reports & Segments > Manage Segments > Click Featured Products > Edit > Update Records Limit to 4.
Screenshot Here

Related

In Opencart 3 under PHP 8 how do I call module to show in another page

I have seen on this site the post re calling a module on needed page. I have tried to use this code to solve a problem. This code does not appear to work for me.
What I have is a module that places a label over each product depending on its status. It works well on products throughout site. However I have a module which calls all products on to one page. I want the label to appear on the products on this all products page.
Banner on product
The code I used in catalog/controller for the all product extension from previous post here was (382 is the label module number):
$this->load->model('382');
$my_variable = $this->model_setting_module->getModule('382');
$data['any_variable'] = $my_variable['any_variable'];
On Template page:
{{ any_variable }}
How can I get the module to be apply the label to the custom all products page?
As always help appreciated
Create new module with name: "my_module" and you can call it in your "another_module" controller file:
$data['my_module'] = $this->load->controller('extension/module/my_module');
and in corresponding "another_module" template file you can retrieve it:
{{ my_module }}

Removing stylesheets issues (wp_dequeue_style)

I'm having trouble removing (wp_dequeue_style) all the stylesheets loaded in a WP site.
I want to remove all the styles loaded, with the purpose of recreating a new style that can be better controlled and optimized and reduce 68 requests to 1.
But before I get further into this, I'll say a bit about the tools used.
I'm using Wordpress v5.4.1 on a server with Apache 7.2.30. The WP theme is MasterStudy Child and the plugins used are as follows:
Breadcrumb NavXT
BuddyPress
Contact Form 7
GamiPress
GTmetrix for WordPress
WPBakery Page Builder
MasterStudy LMS Learning Management System PRO
MasterStudy LMS
Paid Memberships Pro
Slider Revolution
GDPR Compliance & Cookie Consent
STM Configurations
Transients Manager
UpdraftPlus - Backup/Restore
WooCommerce
WordPress Importer
WP Reset
Query Monitor
I can get a list of all enqueued CSS stylesheets using 3 methods:
1. Chrome Inspector - Network tab
2. Query Monitor
3. The script bellow, used in functions.php of parent theme
function remove_theme_head_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2>";
foreach( $wp_styles->queue as $handle ) :
echo $handle . ", ";
endforeach;
}
add_action( 'wp_enqueue_scripts', 'remove_theme_head_styles', 9000 );
The results are as follows:
Method 1 (Chrome): 68 requests, though some are duplicates
Method 2 (Query Monitor): 66 Styles
Method 3 (php script): 52 results
Next, lets switch from listing all the enqueued CSS files, to removing them with this script
function remove_theme_head_styles() {
global $wp_styles;
foreach( $wp_styles->queue as $handle ) :
wp_dequeue_style( $handle );
wp_deregister_style( $handle );
endforeach;
}
add_action( 'wp_enqueue_scripts', 'remove_theme_head_styles', 9000 );
Let's see what we have now:
Method 2 (Query Monitor): 13 styles - all of them loaded in the footer. 10 of them are coming from the parent theme and the other 3 from the theme's main plugin MasterStudy LMS
Method 1 (chrome): 14 requests, same as QM except for 1 extra font family CSS
Method 3 (php script echo): 0 results
So, maybe we need to change the hook, go further down the hooks order, to also include the stylesheets enqueued in the footer.
Let's try wp_print_footer_scripts with a big number for priority
add_action( 'wp_print_footer_scripts', 'remove_theme_head_styles', 9000 );
The results are:
Method 1 (chrome): 65 requests, WTF? almost all of them have loaded!
Method 2 (Query Monitor): 0 Styles
Method 3 (php script): 0 results - same hook used for listing, wp_print_footer_scripts
And YES the webpage has rendered accordingly, so the Chrome Inspector is not wrong, but this doesn't mean that the other 2 methods have false results. It just means that the CSS files are re-enqueued after the results of methods 2 and 3 are generated
But how is this happening I cannot understand.
I have also tried splitting the removal process into 2 hooks, 1 with wp_enqueue_scripts and another with different hooks like wp_footer and such, but with no success
The 10 'trouble' styles coming from the theme itself, are loaded with this function
themes/masterstudy/inc/custom.php
function stm_module_styles($handle, $style = 'style_1', $deps = array(), $inline_styles = '')
{
$path = get_template_directory_uri() . '/assets/css/vc_modules/' . $handle . '/' . $style . '.css';
$handle = 'stm-' . $handle . '-' . $style;
wp_enqueue_style($handle, $path, $deps, STM_THEME_VERSION, 'all');
if (!empty($inline_styles)) wp_add_inline_style($handle, $inline_styles);
}
Here's an example of using the function above
themes/masterstudy/vc_templates/stm_mailchimp.php
stm_module_styles('mailchimp', 'style_1', array(), $inline_styles);
Obviously, if I comment that line then the CSS won't be loaded, but this is not the approach I want to take to solving the problem.
So, if anyone can offer some help, it would be much appreciated
Thanks for taking the time and reading through this
The below is likely not a great approach, but I recently needed to prevent VC from loading the free version of FontAwesome (I use the pro version in my theme) and no amount of dequeue/deregister would work - the below is the only way I could stop it loading (without editing files outside my theme).
The thing that actually worked, was brutally unsetting the entry in wp_styles.
function hack_dequeue_fa() {
global $wp_styles;
$remove = array(
'vc_font_awesome_5',
'vc_font_awesome_5_shims',
);
foreach($remove as $handle) {
wp_dequeue_style($handle);
wp_deregister_script($handle);
unset($wp_styles->registered[$handle]);
}
}
add_filter( 'wp_enqueue_scripts', 'hack_dequeue_fa', PHP_INT_MAX );

How to display limited brands in bigcommerce

I am setting up a store in bigcommerce. In my theme there is a list of brands on the bottom of the page. It is displaying 10 brand names and i want to display only 4 or 5 brand names. can anyone help me how i can limit brands?
Hardeep, you'll need to use a javascript that removes the extra list items. Possibly just use jQuery slice
$(".Brands ul li").slice(5).remove();
http://api.jquery.com/slice/

trac: modification roadmap thru style.css doesn't work

I'd like to add new group on the trac roadmap progress bar. To do this I've modified trac.ini file with:
# Definition of an 'rejected' group:
rejected = rejected
rejected.order = 2
rejected.css_class = my
rejected.label = rejected
where I've associated to css_class atribute value my.
Next I've created style.css file with one line only:
table.progress td.my { background: blue; }
The file style.css is read however the colour is not applied.
When I change back to the default one i.e.
rejected.css_class = new
the progress bar is updated and displaying yellow colour as expected.
However, it not displaying when I use
rejected.css_class = my
Any ides why?
First, for reference, the authoritative documentation on the subject is in trac.edgewall.org's wiki.
Now, did you try with other color expressions, like the common hex values, i.e. #BAE0BA (green Trac default for closed)? You could even try to set the full range of values for the background key like none repeat scroll 0 0 #BAE0BA.
Remember that CSS styles will override each other depending on the order in which they are encountered. The page may be loading your custom style correctly, but if another stylesheet is loaded after your style.css and that stylesheet includes any styles that conflict with yours, then the later stylesheet will override yours. Double-check that your custom stylesheet is being included and isn't being silently overridden by another stylesheet (I find the Firebug plugin for Firefox to be helpful in tracking down these sorts of issues).

Opencart thumbnail size

I've just started to work with opencart so I don't very much. I want to change the thumbnail size of my products to a bigger size. So, I've researched on Google and an answer came up. Go to System>Settings, Edit Store and under the Image tab, choose the size I want. The thing is, that is not working and I don't know why. For example, on Best Sellers or on Featured Products, the thumbnail size is always the same, 80x80.
Any help?
Tiago Castro
In OpenCart 1.5.4 it's System > Settings > Edit > Image in the Admin panel.
Most of the modules use the "thumb" size for the home page position but have static image sizes coded for the left/right columns.
You have two options... Either switch the template to pull the thumbnail size:
Edit /catalog/view/theme//module/.tpl
(replace with your theme if you have one and with bestseller.tpl and/or featured.tpl)
replace $product['image'] with $product['thumb']
Although then your thumbnails may be oversized for your left/right columns...
The other option is to edit the controller and specify the size...
Edit /catalog/controller/module/.php (again either bestseller.php or featured.php)
In 1.4.9.x around line 67-68 you will find:
$this->data['products'][] = array( // From line 58
....
....
// Line 67
'image' => $this->model_tool_image->resize($image, 38, 38),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
Just decide if you want to hardcode the new image size (in this example it is 38x38) or link the 'image' size to the thumbnail size.....
if you are hardcoding it, just c hange the "38, 38"...
If you want to link it to the thumbnail size, just copy the value from 'thumb'
In Admin panel, go to extensions>Features>Edit, in edit mode change 80x80 to anything you like, I assume you want it equal to the rest of the images, if so edit it to match. Repeat for Latest module.
No need to edit any code. Go to:
Extensions -> Modules ->Latest
and you can edit the image size from there.
extensions>features>edit also helped me to increase the size of image in thumbnail. thanks a lot.....
extensions>Features>Edit helped me, I just had to put the same image size that i put in System > Settings > Edit > Image (in Product Image Thumb Size).
I am using the version 1.5.6
For New Opencart version 2.3.0.2 , might help for new versions
you can go to Extensions > Extensions > choose Themes from the 'Choose the extension' type selector and then click > Edit on your theme, to view the Images section and change your image sizes.