On our Magento 1.6.2 website we have enabled Google Sitemaps and added some manually with updates through cron.
What happens now is that the page Catalog > Google Sitemap in it's filters tells us that 4 records were found.
But it doesn't show anything below the filters.
Through looking at the source code I've found that the div with class sitemapGrid only has a total height of 33px and the div with class grid that should display the sitemaps only has a total height of 7px, 6 of which are padding.
The sitemapGrid_table is 0px high, with a 1px border.
But no tr nor td.
After some more digging I've found that the file in which it all happens is design > adminhtml > default > default > template > widget > grid.phtml
The page runs till the end of the first foreach after "grid" and then stops.
<div class="grid">
<div class="hor-scroll">
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
<?php foreach ($this->getColumns() as $_column): ?>
<col <?php echo $_column->getHtmlProperty() ?> />
<?php endforeach; ?> <!-- Runs to here and then stops executing, but who knows why? -->
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
<thead>
<?php if ($this->getHeadersVisibility()): ?>
<tr class="headings">
<?php foreach ($this->getColumns() as $_column): ?>
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
<?php endforeach; ?>
</tr>
<?php endif; ?>
<?php if ($this->getFilterVisibility()): ?>
<tr class="filter">
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
<?php endforeach; ?>
</tr>
<?php endif ?>
</thead>
If I comment out the first foreach, the code keeps running till it ends the first foreach in "headings". And so on (comment out one, runs till end of next one, ...)
Anyone have any idea on where the problem really lies and/or a solution?
So,
Long story short:
exception.log wasn't being filled so once that was solved I got to see that Magento couldn't find a certain blocktype.
Solved an error in config.xml and it all works just fine.
Related
I have a custom attribute for products in which I add a video URL.
I made this Embed video responsive using css.
Now I want to call the custom attribute on the product page, so it shows the video.
The file responsible for this is: description.phtml
I've tried the following:
?>
<?php $_description = $this->getProduct()->getDescription(); ?>
<?php if ($_description): ?>
<h2><?php echo $this->__('Details') ?></h2>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
</div>
<div class="std">
<?php echo $_product->getAttributeText('video') ?>
</div>
<?php endif; ?>
But I get the error:
Fatal error: Call to a member function getAttributeText() on a non-object in /data/web/public/app/design/frontend/base/default/template/catalog/product/view/description.phtml on line 40
The video does show however. I'm probably doing this all wrong. Can I fix this with a simple edit of the code, or do I have to use an entirely different approach?
Thanks.
<?php echo $this->getProduct()->getAttributeText('video'); ?>
Try this. Or on top of document add this
<?php $_product = $this->getProduct(); ?>
I am not a programmer by any means. I purchased the script and have spent two weeks and many variations trying to get the code to do what I need. It is 'almost' there.
<div id="step-2" style="position:absolute; center:overflow-y:;">
<?php if($images): ?>
<?php foreach ($images as $img => $data): ?>
<a href="javascript:;" class="pin-img">
<img src="<?php echo $img ?>" />
</div>
</a>
<?php endforeach; ?>
<?php else: ?>
<h2><?php echo Yii::t('yii', 'No relevant found!') ?></h2>
<?php endif ?>
</div>
It returns the images from a site. It only lets me select the first image. Even though all images are displayed. Only one is actually clickable. If I hover over each of the images I see the javascript href. I understand that to be some sort of place holder. that just makes the browser show the hand.
I just need the script to allow each item to be a choice for reaction.
http://silenceisnotawkward.com/Sinapin/Script/# is the live code.
I have made a test user
Test=user
Password =password in case anyone wants to see what the site does.
http://www.ew.com/ew/ is a good link to pin from website and see the behavior.
I didn't look at your site, but looks like you are confusing your nesting of HTML tags, because you introduced a end-of-dev tag in your link.
<div id="step-2" style="position:absolute; center:overflow-y:;">
<?php if($images): ?>
<?php foreach ($images as $img => $data): ?>
<a href="javascript:;" class="pin-img">
<img src="<?php echo $img ?>" />
<!-- I removed the < / div > from here -->
</a>
:
<?php endforeach; ?>
</div
>
HINT: I indented the code to make it more readable, Try doing the same with your code you posted and see where it leads you.
when we upload one product, there is a default attribute set "Default", and in the general tab, there are many default attributes like below image:
well, i added one more custom attribute named "size", when i drag 'size' to general tab on the left, that mean the product has one more attribute. if i want to show the size attribute in the product view page of front end page, i have to put the code: "$_product->getAttributeText('size')", if i added lots of custom attributes, i have to put lots of codes manually. so, my question is how i can show all custom attributes automatically instead of adding one by one manually ?
This is allready done by magento.
Mark your attributes as vissible in frontend and thats it.
Have a look at the template attributes.phtml in path app/design/frontend/yourtheme/default/template/catalog/product/view
<?php if($_additional = $this->getAdditionalData()): ?>
<!--h2><?php echo $this->__('Additional Information') ?></h2-->
<div class="data-table accordion" id="product-attribute-specs-table">
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
<div class="clearer <?php echo $this->htmlEscape($this->__($_data['label'])) ?>">
<div class="trigger"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></div>
<div class="triggerContent" style="display: none;"><span><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></span></div>
</div>
<?php } ?>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
You need to copy the default file from /app/design/frontend/base/default/template/catalog/product/view to your theme directory
/public_html/app/design/frontend/default/yourtheme/template/catalog/product/view
I have a magento 1.7.0.2 install. I created a shopping price cart rule with coupon. Everything is fine except that the discount amount displayed in magento (cart, checkout,...) is an extremal value. I found out that extremal value is 2^64 (18 446 744 073 709 550 520). The configuration of the rule does not matter, the displayed discount is 2^64 always.
The subtotal is fine, the shipping is fine the sum of these is 11669. after applying the discount(10%) on the subtotal(10961) the result is 9864. 9864+708=10573 is an acceptable result. So Everything is perfect except the displayed discount.
I don't know where does it go wrong. I can't find the related file. Please help.
Thanks a lot,
István
After all I found the solution. The cause of this error is simple. The discount amount stored by magento is signed, that means it has a negative sign. The file app/design/frontend/[yourfrontend]/[yourtheme]/template/checkout/total/default.phtml ( this is where the amount is written on screen) contains the following code:
<tr>
<th colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</th>
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
The problem is the formatPrice() function, and the negative parameter. A simple solution is the abs() php function. Change the line
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
to
<?php echo $this->helper('checkout')->formatPrice(abs($this->getTotal()->getValue())) ?>
And here we go, the problem solved.
I hope that helps.
I figured out how to display my custom multiselection attributie as a list but havent been able to figure out how to add an ID or class to every list item. This would allow me to display an image using CSS instead of text.
Hope you guys can help me. By the way, this is the code I use to display my custom attribute "rating" as a list:
<?php if($_product->getResource()->getAttribute('rating')->getFrontend()->getValue($_product)): ?>
<ul><li><?php
$_comma = ",";
$_list = "</li><li>";
echo str_replace($_comma,$_list,$_product->getResource()->getAttribute('rating')->getFrontend()->getValue($_product)) ?>
</li></ul>
<?php endif; ?>
</div>
Without knowing the exact format of the return of your function, I can't be 100% sure, but I think this would do the trick:
<div>
<?php if($_product->getResource()->getAttribute('rating')->getFrontend()->getValue($_product)):?>
<ul>
<?php $i=0?>
<?php foreach(explode(',', $_product->getResource()->getAttribute('rating')->getFrontend()->getValue($_product)) as $value) : ?>
<li id="value_<?php echo $i?>"><?php echo $value ?></li>
<?php $i++ ?>
<?php endforeach ?>
</ul>
<?php endif; ?>
</div>
It would probably be a little easier to just modify your return to give you back an array, but if the return is a comma separated list and not easy to change, then explode should do the trick.