is Module position vacant or not - joomla

i have created a New position"sidebar-left" is Yootheme's Nano 3 Template.
Yootheme allows only one side sidebars, either left or right.
so i keep it to sidebar-right and create new position Sidebar-left. because i need both side sidebars.
Now my problem:
i kept the width of main content areas to 65%, so when there is no sidebars modules exist in the page, my main content still uses 65% width of page. i need it to cover more are than this because now sidebar modules are not linked.
so i want to know what is the way to knw weather module position is vacant or not. so that i can apply conditions.
or is there any other you people can suggest?
Thanks in Advance

I found the solution,
first you need to count number of module in the mentioned position
if($this['widgets']->count('sidebar-left') == 0)
if this satisfies then,
{
?>
<?php if ($this['config']->get('system_output', true)) : ?>
<main class="**tm-content1**">
<?php if ($this['widgets']->count('breadcrumbs')) : ?>
<?php echo $this['widgets']->render('breadcrumbs'); ?>
<?php endif; ?>
<?php echo $this['template']->render('content'); ?>
</main>
then we need to render the main content output as done above.
we cannot dynamically change the css with php so we need to create new css class with the larger width and put in if case, and then in
else case put the same code to make it run with the main css class.

Related

Decrease image size in product view page

we have backend condfiguration to resize product images. so we set 850 * 850 for our images.
now in product view page images are showing in very large size, i want to reduce it to 350 * 350 size
we are using below code :
<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image')); ?>
This is the same query asked in your previous post, check the previous post. You need to modify your css
etalage .etalage_thumb_image{height:350 !important; width:350 !important;}

Sort products by attribute filter different select

What i want to do is create a new sort in the product listing page with an attribute.
Let's say I have and attribute named Color, with the labels Red, Green, Blue. In the product listing page i want to sort products by Color, so if i select Red only products with attribute red should appear.
I have tried everything but nothing works.
What i have in /mytheme/default/template/catalog/product/list/toolbar.phtml is the default select, where all attributes are listed like this:
<select onchange="setLocation(this.value)">
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
<?php echo $_limit ?>
</option>
<?php endforeach; ?>
Ideas ? Thank you.
Sorting is a way which will just change the order of products but will not eliminate the products from its collection. I believe what you are looking for is a color filter.
What I mean is , if you sort by color red, the products with color red will appear on the top or bottom depending on the order of sort, while remaining products will be below or above it.
While if you consider it as a filter in layered navigation, if you select color red, it will only show red color products while other will be eliminated from list collection.

SCSS List Item Color Iteration

I'm completely new to SCSS and I'm trying to set a background color to all items of a selector.
My css selector is the following, and returns all items (of two seperate UL lists)
#g-showcase .g-menu-item
I set a color array as:
$colors: #fad941, #ffffff, #e02520, #a6a6a6, #c6c6c6, #e02520;
I would like to iterate over my selector results and set a unique color from my color array (which could be larger than the above).
I started playing with some code, but I tackled it incorrectly, as I'm iterating over colors and not over selector items. (Don't know how to do that :( )
#for $i from 1 through length($colors) {
#g-showcase li:nth-child(#{length($colors)}n+#{$i}) {
background: nth($colors, $i)
}
}
How could I achieve the desired result?
Thank you !
S.
The problem you have is - as far as SASS is concerned - it's ignorant to how many li items your HTML code has, it's a pre-processor that never really see's the DOM, so it wouldn't know when to stop generating CSS
I assume what your looking to do is have the ability to select which color each li item has set as it's background, rather than as you currently have it, which is applying colors in the order they appear in the color array.
To do this you could add some additional markup to you HTML to give the generated CSS and slightly tweak how your creating the array, using a map instead. You might be looking to avoid polluting your HTML will erroneous mark-up, but the below would work.
$colorz: (
foo: #f24162,
bar: #591240,
fee: #4c5573,
fum: #6fa0a6,
eye: #71d9d9
);
#each $pointer, $bgcolor in $colorz
{
#g-showcase li[pointer="#{$pointer}"] {
background: $bgcolor;
}
}
<ul id="g-showcase">
<li class="g-menu-item" pointer='bar'>The quick</li>
<li class="g-menu-item" pointer='foo'>Brown Fox</li>
<li class="g-menu-item" pointer='fee'>Jumped over</li>
<li class="g-menu-item" pointer="bar">the lazy</li>
<li class='g-menu-item' pointer="eye">dog</li>
</ul>
<ul id="g-showcase">
<li class="g-menu-item" pointer="fum">...and other exciting stories</li>
<li class="g-menu-item">that you hear from time-to-time</li>
</ul>
Note The above wont 'run' as it's sass, so there's a working version over on CodePen http://codepen.io/anon/pen/GJLXMq

Overriding a variable value for a specific element

I have a small project, where i first tried Zurb Foundation framework, heavily using SASS variables for customization, and i got one problem.
I use their block-grid extensively, and i need to change $block-grid-default-spacing: variable value to rem-calc(2), but only inside a #gallery element, and leave it at default value elsewhere.
If it helps, i use simple code for my gallery (with some irrelevant Smarty templating)
<section id="gallery-container" class="row">
<ul id="gallery" class="clearing-thumbs small-block-grid-2 medium-block-grid-3 large-block-grid-4" data-clearing>
{foreach from=$offer->photos->get() item=photo}
<li>
<img src="{$photo->image->thumb(true, 295, 230, 5)}" alt="{$offer->title->get()}"/>
</li>
{/foreach}
</ul>
</section>
From the docs on the Foudation page, I think they have a mixin that is available to create your own block-grid. The following was take from http://foundation.zurb.com/docs/components/block_grid.html:
.your-class-name {
#include block-grid(
// This controls how many elements will be on each row of the block grid. Set this to whatever number you need, up to the max allowed in the variable.
// Available options: 1-12 by default, and false.
$per-row: 3,
// This controls how much space is between each item in the block grid.
// Use a variable or any pixel or em values.
$spacing: $block-grid-default-spacing,
// This controls whether or not base styles come through, set to false to leave out.
$base-style: true
);
}
Using block-grid mixin turned out to be a great idea that solved my problem. That's how my code looked like in the end:
#gallery
#media #{$small-up}
+block-grid(2, rem-calc(3))
#media #{$medium-up}
+block-grid(3, rem-calc(3))
#media #{$large-up}
+block-grid(4, rem-calc(3))

Issue with resizing the image in product view page (media.phtml) magento

I am trying to resize image in product view page, but after the image has resized, white spaces come along in left and right both the sides (width), in resize function I gave the value 338,474, but It comes with white spaces. For that I applied function keepFrame(false).
But after applying that, my image height remains same, but width changes to 271. What should I do? Below is my code.
<img src="<?php echo $this->helper('catalog/image')->init($product, 'image')->keepFrame(false)->resize(338,474);?>" alt='' title="<?php echo $this->htmlEscape($this->getImageLabel());?>" />
I tried keepFrame(false) both before and after resize(338,474).
Please, if any body can help me.
Simply pass your height and width in following function resize
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(338, 474).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
Try to do the following steps, (let's say you want 150 width):
Go and open default/template/catalog/product/view/media.phtml.
Now On line 54 find the delete the ‘width’ and ‘height’ attributes in the tag.
On the same line (54), find.
$_image->getFile()->resize(150, 150);
All good. Simply replace one of these numbers with 0 and the image will auto scale. e.g.:
$_image->getFile()->resize(150, 0);
It will give you images 150 pixels wide, but the height will vary according to the original image ratio.
Hope that helps.

Resources