I need to have a banner image for the first post but it needs to expand vertically because posts will vary in the amount of content. currently I have this in y loop.php
<article class="post <?php echo !is_single() ? "preview" : "" ?> <?php echo $count == 0 ? "first" : "" ?> <?php echo !is_home() ? "full" : "" ?>">
I cannot attached the image since I do not have the correct reputation on this site!
However, the image is a banner that will wrap the edges of the main content div. I sliced it into 3 separate images-- a top, middle, and bottom-- thinking I could just use :before and :after in my css but this will not work in IE7 or 8 for me.
My class currently for the first post is "first" but I would need to add a top and bottom to this I think but I would like the best solution and I am too much of a newbie.
I feel I am really stuck and need some help. Let me know if you need more to go off of I can see what I can do about getting an image on this site to show you what needs to happen here.
If your theme uses body_class as it should then there should be class named author attached to the <body> tag for author archives. You can use that to simple not display the divs-- via display:none.
You almost had the PHP solution though, if I understand you. You need is_author instead of is_single
<?php if (!is_author() && $count == 0): ?>
<div class="firsttop"></div>
<?php endif; ?>
<!-- more Loop code -->
<?php if (!is_author() & $count == 0): ?>
<div class="firstbottom"></div>
<?php endif; ?>
If that isn't it, I don't know you mean by "the author's page".
Related
I'm having trouble with my magento store's layout. Some products with long titles would get cut off with a '...' but sometimes the title won't get cut off the title and instead throw out my layout's positioning. I have attached a photo
Photo of issue
I have tried the substr function in app/design/frontend/interface/theme/template/catalog/product/view.phtml
but it just ended up cutting the product's name in the actual page of the product, not the full view like the image above shows. I just need the '...' to happen without as many characters to prevent it going to a new line and ruining the layout.
Use this trick in PHP, use substr function :
Go to template > catalog > products > list.phtml file and update product name code with this code
<?php
// define the maximum length of the product name here
$maxLength = 10;
$productName = $_helper->productAttribute($_product, $_product->getName(), 'name');
echo substr($productName, 0, $maxLength).'...';
?>
In a blog_item I'm able to render tags with the following:
if ($params->get('show_tags', 1) && !empty($this->item->tags)) :
$this->item->tagLayout = new JLayoutFile('joomla.content.tags');
echo $this->item->tagLayout->render($this->item->tags->itemTags);
endif;
However, in one case I would need to render all available tags in a blog, without having a $this-item (since no item is selected)
Is there some way to accomplish this?
Thanks!
I'm developing a Magento store and I need to display the color and size of a simple product in front end, is it possible?
I got it only with configurable product but not with simple product.
Something like this:
http://www.saiajustamodafesta.com.br/loja/vestido-longo-saia-justa.html
Anybody can help me?
Thanks.
in your frontend/[your-package]/[Your-theme]/template/catalog/product/view.phtml file
$color = $_product->getColor();
<img src="<?php echo $this->getSkinUrl('images/'.$color.'.jpg'); ?>">
you need to upload jpg image same as color name ex red.jpg as well as same as size
Get color image attribute
$color_code="color";
$colorValue = $objectManager->get('Magento\Catalog\Model\Product')->load($_product->getId())->getData($color_code);
$swatchHelper=$objectManager->get("Magento\Swatches\Helper\Data");
$swatchData = $swatchHelper->getSwatchesByOptionsId([$colorValue]);
<img class="object-fit-contain w-100 h-100" src="<?=
$objectManager->get('Magento\Store\Model\StoreManagerInterface')
->getStore()
->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).
'attribute/swatch'.$swatchData[$colorValue]['value']?>" alt="color"/>
For Magento 2 if you have got quote item or a product object that is doesn't contain color attribute:
$product = $_item->getProduct();
$product->getResource()->load($product, $product->getId(),['color']);
//then you can get attribute data
$value = $product->getColor(); //52
$label = $product->getResource()->getAttribute('color')->getFrontend()->getLabel(); // Color
$text = $product->getResource()->getAttribute('color')->getFrontend()->getValue($product); //Orange
in your view.phtml getColor(); ?> replace with any attribute code, the important here is that the attribute must be on the catalog_product_flat tables, in order to do that, your attribute must be defined as "use_in_product_listing". Greetings.
Magento ver. 1.5.1.0
I have an attribute set “clothing”
There are two attributes in the set: “size” and “colour”
Size is required, colour is optional (i.e. not all products have any colour options).
I have created some Simple Products where the Size is set but Colour just has the empty value.
On the product page for the relevant Configurable Product no option inputs are shown! And in the product view.phtml if I echo $this->hasOptions() it prints an empty string, ie False.
If I set the Colour to a non-empty value then both select boxes are shown on the product page and echo $this->hasOptions() prints 1, ie True.
This doesn’t make sense to me, not sure what is failing?
Im struggling with something similar and have noticed similar behavior to what you have described.
Check first if the product is actually properly configurable. this is taken from another post in SO and was meant to part of a controller. Drop this on the front end ../template/catalog/product/view.phtml just to check.
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
?>
<?php
if ($_product->isConfigurable()) {
$configurable = $_product->getTypeInstance();
$attributes = $configurable->getConfigurableAttributes($_product);
foreach ($attributes as $attribute) {
print $attribute->getLabel();
print "<br />";
}
}
?>
so as an answer i think you are becoming confused between custom options and configurable products.
Joomla Question: Is there a way to have a different image in intro text? I plan to place a different and smaller image in the introtext.
Could one not duplicate the the opening paragraph/content above the [Read More] line, except with whatever changes are needed? Then, in the article's Advanced Parameters, set the [Intro Text] value to "Hide" so the intro doesn't appear when the article is displayed normally?
look here:
http://www.theartofjoomla.com/home/5-commentary/81-joomlas-hidden-feature-hiding-intro-text.html
I added these code and it works well in my case
<?php
$text = $article->introtext;
if(preg_match('/<\s*img[^>]+>/Ui', $text, $matches)){
$image=$matches[0];
$text = str_replace($image,'',$text);
}
if ($matches) {
$image = str_replace('img src="','img width="100px" src="',$image);
$image = str_replace("caption","", $image);
echo '' . $image . '';
}
else {echo '<img width="100px" src="/images/defaultarticleimage.jpg"
class="defaultArticleImage" />';}
?>
add to the file components/com-contents/view/category/tmpl/default_articles.php (copy this file to your template first)
It's not possible with the current Joomla code.
The intro text is used to display a brief intro the article (usually on the main page) and then once the user opens the article, the intro text is displayed at the top before the rest of the text