How do you integrate an accordian widget into a helloworld zend project? This is what I have so far and all I get is the page with the messages no accordians.
Bootstrap:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initView()
{
$view = new Zend_View();
//$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$view->addHelperPath('Zend/Dojo/View/Helper/','Zend_Dojo_View_Helper');
$view->dojo()->addStylesheetModule('dijit.themes.tundra');
}
}
Layout File:
<?php echo $this->doctype() ?>
<html>
<head>
<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headStyle() ?>
<?php if ($this->dojo()->isEnabled()){
$this->dojo()->setLocalPath('/js/dojo/dojo.js')
->addStyleSheetModule('dijit.themes.tundra');
echo $this->dojo();
}
?>
<?php echo $this->headScript() ?>
</head>
<body class="tundra">
<?php echo $this->layout()->content ?>
<?php echo $this->inlineScript() ?>
</body>
</html>
View:
<?php // setup required dojo elements:
$this->dojo()->enable()
->setDjConfigOption('parseOnLoad', true)
->requireModule("dijit.layout.AccordianContainer")
->requireModule("dijit.layout.ContentPane")?>
<div style="width: 300px; height: 300px">
<div dojoType="dijit.layout.AccordionContainer" style="height: 300px;">
<div dojoType="dijit.layout.ContentPane" title="Heeh, this is a content pane">
Hi!
</div>
<div dojoType="dijit.layout.ContentPane" title="This is as well" selected="true">
Hi how are you?
</div>
<div dojoType="dijit.layout.ContentPane" title="This too">
Hi how are you? .....Great, thx
</div>
</div>
</div>
Related
For example this working code:
home view:
<div class="slider variable-width">
<?php $this->load->view('product/_product_item_slider'); ?>
</div>
and in product/_product_item_slider
<?php foreach ($this->product_model->get_products_by_category_id(1) as $product): ?>
<?php echo get_product_item_image($product); ?>
<?php endforeach ?>
but when I do in this way:
home view:
<div class="slider variable-width">
<?php foreach ($this->product_model->get_products_by_category_id(1) as $product): ?>
<?php $this->load->view('product/_product_item_slider'); ?>
<?php endforeach ?>`
</div>
and in product/_product_item_slider
<?php echo get_product_item_image($product); ?>
I get:
Message: Undefined variable: product
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'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...
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?
BootStrap.php:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initView()
{
// Initialize view
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->headTitle('Book Store');
$view->headScript()->setFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
$view->headScript()->appendFile('../../js/jquery.pagination.js');
$view->headLink()->setStylesheet('../../css/style.css');
$view->headLink()->appendStylesheet('../../css/pagination.css');
$view->headLink()->appendStylesheet('../../css/formError.css');
$view = new Zend_View();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $view;
}
}
Index.phtml:
<?php echo $this->ajaxLink("Show me something",
"test",
array('update' => '#content'));?>
<div class="left_content">
<div class="title"><span class="title_icon"></span>Featured books</div>
<div class="title"><span class="title_icon"></span>New books</div>
<div class="new_products">
<div id="content"> </div>
<?php
$result=$this->result;
foreach($result as $bookName){
?>
<div class="new_prod_box">
<b> <?php echo $bookName['book']; ?></b>
<div class="new_prod_bg">
<span class="new_icon"><img src="../../images/new_icon.gif" alt="" title="" /></span>
<img src="../..<?php echo $bookName['pic']; ?>" alt="" title="" class="thumb" border="0" />
<input class="register" type="button" value="AddtoCart">
</div>
</div>
<?php
}
?>
</div>
<div class="clear"></div>
</div><!--end of left content-->
Here my ajaxlink() is not working it's redirect to "application error page".
Is the route "test" actually valid? since if it doesn't exist that would explain why you get an application error page