I've managed to show the prices for each product, but I can not show the star ratings for each product, this is a separate template file, I'm referencing the original list.phtml but something isn't right, I can only assume I'm missing something:
<div class="category-products">
<div class="products-grid">
<?php
$_helper = Mage::helper('catalog/output');
$categoryid = 26;
$category = Mage::getModel('catalog/category');
$category->load($categoryid);
$collection = $category->getProductCollection();
$collection->addAttributeToSelect('*');
foreach ($collection as $_product) {
?>
<div class="item">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<h2 class="product-name"><?php echo $_product->getName(); ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php
$product_block = new Mage_Catalog_Block_Product;
echo $product_block->getPriceHtml($_product);
?>
<div class="actions">
<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</div>
</div>
<?php } ?>
</div>
The getReviewsSummaryHtml() is not showing the stars...
Related
I think I wrote everything in the headline. Here are two examples:
PhpStorm
Visual Studio Code
It seems that Visual Studio does his job much better but I'm completely into PhpStorm so I cant switch because of that right now. Do you have any ideas on how can I match the Code Format?
Here is the code-snippet
<div <?php echo $this->cssID; ?> class="content--element <?php echo $this->class; ?>">
<div class="ce--inner container">
<?php if ($this->headline || $this->subline) : ?>
<div class="ce--headline"
data-aos="<?php if ($this->animation_type) : ?><?php echo $this->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
<?php if ($this->headline) : ?>
<<?php echo($this->hl); ?>>
<?php echo($this->headline); ?>
</<?php echo($this->hl); ?>>
<?php endif; ?>
<?php if ($this->subline) : ?>
<span class="ce--subline"><?php echo $this->subline; ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->boxes) : ?>
<div class="row">
<?php foreach ($this->boxes as $box) : ?>
<div class="<?php if ($box->column_width) : ?><?php echo $box->column_width; ?><?php else : ?>col-12 col-md-6 col-lg-4<?php endif; ?>">
<div class="advantages--box"
data-aos="<?php if ($box->animation_type) : ?><?php echo $box->animation_type; ?><?php else : ?>animate__fadeInUp<?php endif; ?>">
<?php if ($box->ce_headline) : ?>
<div class="advantages--headline">
<?php if (!$box->onlystyle) : ?>
<<?php echo $box->headline_type; ?>>
<?php echo $box->ce_headline; ?>
</<?php echo $box->headline_type; ?>>
<?php if ($box->ce_subline) : ?>
<span class="ce--subline advantages--subline">
<?php echo $box->ce_subline; ?>
</span>
<?php endif; ?>
<?php else : ?>
<span class="<?php echo $box->headline_type; ?>">
<?php echo $box->ce_headline; ?>
</span>
<?php if ($box->ce_subline) : ?>
<span class="ce--subline advantages--subline">
<?php echo $box->ce_subline; ?>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($box->text) : ?>
<div class="advantages--text">
<?php echo $box->text; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach ?>
</div>
<?php endif; ?>
</div>
</div>
i want to send a request to a user to join community, so firstly i want to check if the username is exists in the database..then send request data, so how i can do it? here is the code :
<?php echo CHtml::beginForm('','post',array('enctype'=>'multipart/form-data')); ?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'users-form',
'enableAjaxValidation'=>true,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'userName'); ?>
<?php echo CHtml::textField('userName','',array('size'=>45,'maxlength'=>255, 'id'=>'in')); ?>
<?php echo $form->error($model,'userName'); ?>
</div>
<div class="row buttons">
<?php $urlDe=CHtml::normalizeUrl(array("users/communities/".$model->idUser)); ?>
<?php echo CHtml::submitButton('Send',array('submit' => $urlDe, 'id'=>'but')); ?>
<?php //echo CHtml::submitButton($model->isNewRecord ? 'Create' :'Send', array('id'=>'but')); ?>
<?php echo CHtml::resetButton('Reset', array('id'=>'but')); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
<?php echo CHtml::endForm(); ?>
this is the invite action..how i can send the invite data to an action belong to the user?
the community and user are in the same model.
Using Magmi to upload a CSV to set simple products to be Not Visible Individually.
After clearing Magento Cache and Reindexing, the products still show on the category page however clicking on the simple products give you a 404 page.
Is there anyway to stop these products showing on the category page.
Example of were this happens http://boxchilli.co/s2as/kayaks-1.html
PROTEC ACE WATER HELMET - WHITE at the top isn't ment to show but the PROTEC ACE WATER HELMET - WHITE2 is
Code for list.phtml added below
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<!--<script type="text/javascript">
jQuery(window).load(function() {
jQuery('.page').css('background-image','none');
});
</script>-->
<?php else: ?>
<div class="category-products">
<?php $position = 'top'; ?>
<?php echo $this->getToolbarHtml($position) ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<ol class="products-list" id="products-list">
<?php foreach ($_productCollection as $_product): ?>
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
<?php // Product Image ?>
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(130); ?>" width="130" height="130" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<?php // Product description ?>
<div class="product-shop">
<div class="f-fix">
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product) ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->isSaleable()): ?>
<p><button type="button" title="<?php echo $this->__('BUY NOW') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('BUY NOW') ?></span></span></button></p>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<div class="desc std">
<?php $shortened = truncateText($_product['description'],250,'.'); ?>
<?php
$product_data = $_product->getData();
if($_product->getName() == 'Mystic Warrior III (3) Kitesurf Waist Harness 2012 - Black'){print_r($product_data);}
?>
<?php print_r($_product['description']); ?>
<?php echo $this->__('Learn More') ?>
</div>
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
</ul>
</div>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
<?php else: ?>
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $_columnCount = 4; ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid">
<?php endif ?>
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(158); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<?php $shortened = truncateText($_product->getName(),250,'.'); ?>
<h2 class="product-name"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>
<div class="actions">
<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('BUY NOW') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('BUY NOW') ?></span></span></button>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><?php echo $this->__('Add to Wishlist') ?></li>
<?php endif; ?>
</ul>
</div>
</li>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
<?php endif ?>
<?php endforeach ?>
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
<?php endif; ?>
<?php $position = 'bottom'; ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar_bottom.phtml')->toHtml(); ?>
</div>
</div>
<?php endif; ?>
Resolved the issue.
Indexing was erroring without reporting back and nothing on the error log. By doing each reindex one by one it resolved the problem.
Make sure the products aren't assigned to a category too. I had the same issue with an inherited site.
I installed a bootstrap theme for my yii application to be displayed on its login page.
How do I pass the information entered in these forms to the variables in login.php?
Also, how do I make the "Sign In" button in the theme to call the "Sign in" button in the login.php?
These are the forms in the bootstrap theme:
<div class="clearfix">
<input type="text" placeholder="username">
</div>
<div class="clearfix">
<input type="password" placeholder="password">
</div>
<button class="btn primary" type="submit">Sign in</button>
These are the forms that yii would display with its default theme in login.php:
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Login'); ?>
</div>
for Yii best practice. Dont use login.php file instead use controller/action and in that action define your login logic like this:
Login View file
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Login'); ?>
</div>
And this is your controller action:
public function actionLogin()
{
$model=new LoginForm;
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
if($model->validate() && $model->login()){
//Your Logic//
}
$this->render('login',array('model'=>$model));
}
<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>array('login.php')
)); ?>
Normally Yii calls an action on a controller. Do you know the basics of Yii?
Cant figure the PROTOTYPE script for adding or removing a the css class name "selected" to img element based in click function (already done for Jquery...) but it must be in Prototype. And its driving me crazy. Cant make it work for prototype....
My original code is (Magento store)
<div class="block block-poll">
<div class="block-title">
<strong><span><?php echo $this->__('Community Poll') ?></span></strong>
</div>
<form id="pollForm" action="<?php echo $action ?>" method="post" onsubmit="return validatePollAnswerIsSelected();">
<div class="block-content">
<p class="block-subtitle"><?php echo $this->htmlEscape($poll->getPollTitle()); ?></p>
<?php if( $poll_answers ): ?>
<ul id="poll-answers">
<?php foreach( $poll_answers as $answer ): ?>
<li>
<input type="radio" name="vote" style ="display:none;" class="radio poll_vote" id="vote_<?php echo $answer->getId() ?>" value="<?php echo $answer->getAnswerId() ?>" />
<?php
$stripped = $answer->getAnswerTitle();
$stripped_final = str_replace(" ", "_", strtolower($stripped)); //Value (simplified)
?>
<span class="label"><label for="vote_<?php echo $answer->getId() ?>"><img src="http://www.passione.pt/media/poll/<?php echo $stripped_final; ?>.png" id="chooser" class="chooser" alt="<?php echo $this->htmlEscape($answer->getAnswerTitle()) ?>" onClick="document.getElementById('vote_<?php echo $answer->getId() ?>').checked =true;"/></label></span>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList('poll-answers');</script>
<?php endif; ?>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Vote') ?>" class="button"><span><span><?php echo $this->__('Vote') ?></span></span></button>
</div>
</div>
</form>
</div>
<?php endif; ?>
For Jquery.
Could you transform for Prototype 1.7...?
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
var Chooser = $('#poll-answers img');
Chooser.click(function() {
$('.chooser').removeClass('selected');
if(!Chooser.hasClass('selected')) {
$(this).addClass('selected');
} else {
$(this).removeClass('selected');
}
});
</script>
Prototype version of that click handler (untested):
$('poll-answers').on('click', 'img', function(event, element) {
$$('.chooser').invoke('removeClassName', 'selected');
element.toggleClassName('selected');
});
Edit: Changed to toggleClassName as per #Victor's suggestion. +7 points for him, and from each to invoke thanks to #Geek Num. +7 points for him and 1 left over for me.