Grayed out products that are not available - prestashop

I would like products that are not available on the listings to be displayed in a different color. Ideally, they would be gray or transparent to stand out from those available. How can I achieve this?
https://medpak.com.pl/suplementy-diety/

First of all, if product is not available then it wouldn't be show on the listing unless you set in prestashop panel that you allow to order unavailable products - but why then make them look different if I can still order them?
Anyway, to achieve your target:
Find inside your product-list.tpl line where is code for single product, and to the value of class for element product-container add a little code below to make it look like this:
<div class="product-container {if $product.quantity <= 0}product-grayed{/if}">...</div>
Then in your css add:
.product-grayed img {
opacity: 0.5; // this code for transparent image
filter: grayscale(100%); // this code for gray image
}
Make any other css changes using added class product-grayed

Related

Hawaii template Categories Sidebar Menu

Is there a way to have the categories sidebar menu start in the expanded state? Currently it starts out collapsed and requires the user to expand the top level categories to view the ones underneath.
My store has only one main category right now and I would like to have it expanded unless the user chooses to collapse it
here is a link to the demo page as my site has not been published yet.
http://hawaii-demo.mybigcommerce.com/
[
Since the category list is controlled by a snippet, you would need to use javascript to autoselect/autoexpand that particular parent category.
Something like:
$(document).ready(function(){
if ($('li:contains(parentCategoryName)').hasClass('expandable') {
$(this).addClass('collapsable');
$(this).removeClass('expandable');
}
else {
return null;
}
});
I haven't tested the above script, but that would be one of my first tries. It may require tweaks. You should replace "parentCategoryName" with the name of your parent category that you want to expand.

Target specific slide in Soliloquy slider with url

Does anyone have any experience with using a url to target a specific slide in a Soliloquy slider? I am using multiple sliders that I need to link to specific slides of from external pages/sites. The Soliloquy Docs provide this info (soliloquywp.com/docs/dynamically-set-the-starting-slide/) as closest to the solution but, for a php noob like me, the explanation is a bit terse and lacking, my fault, not theirs.
The example given in the docs seems to be a custom filter for a specific slide in a specific slider. I need to target slides in multiple sliders with urls. I guess I need help understanding the filter's function. I have commented out what I think each part does. Maybe someone could show me where I'm wrong?
//OP: I don't understand, what ids/slides are represented by the 10 and 2 values in these parameters. Where do I find these?
add_filter( 'soliloquy_pre_data', 'tgm_soliloquy_dynamic_starting_slide', 10, 2 );
function tgm_soliloquy_dynamic_starting_slide( $data, $slider_id ) {
// If the proper $_GET parameter is not set or is not the proper slider ID, do nothing.
//OP: Is the 'sol_slide' parameter for ALL soliloquy sliders in my site or is it the name in the Dashboard given when constructing the slider?
if ( empty( $_GET['sol_slide'] ) ) {
return $data;
}
// Change this if you want to target a specific slider ID, or remove altogether if you want this for all sliders.
//OP: I believe to target ALL sliders in my site I should comment this out. Right?
if ( 51064 !== $slider_id ) {
return $data;
}
// Set the slide number as a config property. Also preventing randomizing slides.
$data['config']['start'] = absint( $_GET['sol_slide'] );
$data['config']['random'] = 0;
// Optionally prevent autostarting the slider. Uncomment if you want that.
//$data['config']['auto'] = 0;
return $data;
}
Basically, I guess I am asking for a little help with implementing this filter to target any slide in any slider with a url. Slim odds, but I'm dead in the water! Big thanks to anyone who can shed some light on this for me.
Complete, correctly functioning answer is here provided the plugin author, of course, duh: http://soliloquywp.com/support/topic/a-way-to-link-directly-to-a-specific-slide/
The value "sol_slide" is generic to any slider created with the plugin. Just put the custom filter provided in the example into your, hopefully, child-theme's functions.php, and construct your urls targeting specific slides like so: http://mywebsite.com/specific-product-page-with-slider/?sol_slide=3. Slide numbering is based on zero so 1 = 2 etc. Works like a charm.

Need to lighten a color within the variables passed in a LESS mixin

I am currently updating the bootstrap source less files for a project and I have to modify the hover state for the buttons. The end goal is something along these lines:
.btn-primary {
.buttonBackground(#btnPrimaryBackgroundHighlight, #btnPrimaryBackground);
&.hover {
.buttonBackground( lighten(#btnPrimaryBackgroundHighlight, %20), lighten(#btnPrimaryBackground, %20));
}
}
However, that returns a compile error. Any thoughts on this issue? I'm sure it's something simple, but I'm at a loss. Thanks in advance.
P.S. - I will also be using the :hover pseudo-class, but for sake of example I'm using a simple class.
Put the percent sign after the number (20% instead of %20)

Accessing the different regions of a border layout

In Sencha's API for border layout it says:
There is no BorderLayout.Region class in ExtJS 4.0+
What I found on various blogs, for accessing the center panel was this:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var centerR = viewPort.layout.centerRegion;
Again to the docs, I see that centerRegion is a private function (why?), and I don't care to rely on those, for future proofing. Also, there is no westRegion, northRegion, etc...
How does one get to these items?
I could of course get the items inside the regions: The various panels, and such, but I want complete control of the viewport that holds my border layout.
This is what I'm doing now:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var view = Ext.widget('my-new-tab-panel');
viewPort.layout.centerRegion.removeAll();
viewPort.layout.centerRegion.add(view);
Is there a better way?
Usually, I setup an id for each container I have to work with. So, my center region will have an id and I'll get it with Ext.getCmp() function.
Otherwise, to access to the viewport items you can do as follows:
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var view = Ext.widget('my-new-tab-panel');
viewPort.items.items[0].removeAll();
viewPort.items.items[0].add(view);
If you've defined center region as the first item of viewport, then the above code it's ok but if you've defined it as the third or the fourth, then you have to change the index according to the position of your region (viewPort.items[3] or viewPort.items[4], etc).
Another way is to use query selector:
var cr = viewPort.down('panel[region=center]');
cr.removeAll();
cr.add(view);
However, following this way, you have to query on a precisely xtype (as panel in this case).
Anyway, I think the best way is to use an id for each region.

nivo slider, is a way to always show the next and prev arrows?

I am using nivo slider( default theme) and I positioned the prev and next arrows next to the image(not on top of the image) and I was wondering if there is a way to always show the next and prev arrows(right now the arrows only show when you hover over the image). Seems there should be a way to edit the code to do this but I can't seem to figure out where. Thanks!
directionHideNav: false doesn't work as of 3.1.
Changes now need to be made in CSS
In the theme css file find the line
.theme-default .nivo-directionNav a
Change:
opacity: 0; to opacity: 1;
Right way is;
just change or add directionNavHide value and set it to false in nivoSlider settings.
$('#slider').nivoSlider({directionNavHide:false});
open the nivoslider js file and find
{a(".nivo-directionNav",f).hide();f.hover(function(){a(".nivo-directionNav",f).show()},function(){a(".nivo-directionNav",f).hide()}
change to
{a(".nivo-directionNav",f).show();f.hover(function(){a(".nivo-directionNav",f).show()},function(){a(".nivo-directionNav",f).show()}
Save an upload.
An easy to do it without touching the JS code is just to add a line in your CSS file:
.nivoSlider .nivo-directionNav{
display: block !important; /* ALWAYS show the arrows */
}
I'm not a big fan of !important, but if it means I don't have to adjust the js then it works for me.