I need to show 4 flexible items and load more, I don't know how to make it manually, so I tried that plugin But I can't understand how to make the shortcode correctly
That's what I generated
[ajax_load_more container_type="div" acf="true" acf_field_type="flexible" acf_field_name="review-repeater" post_type="any" meta_key="review-repeater" meta_value="" meta_compare="IN"]
The original flexible content loop without loadmore
<div class="row justify-content-center">
<?php if( have_rows('review-repeater') ):
// Loop through rows.
while ( have_rows('review-repeater') ) : the_row();?>
<div class="rev">
<?php // Case: Paragraph layout.
if( get_row_layout() == 'review-repeater' ):?>
<div class="d-flex justify-content-between">
<div class="rev-left">
<div class="raiting-review"><?php echo get_sub_field('review-raiting'); ?></div>
<div class="review-content">
<p><?php echo get_sub_field('review-content'); ?></p>
<div class="d-flex">
<?php echo get_sub_field('review-author'); ?> , <?php echo get_sub_field('review-date'); ?>
</div>
</div>
</div>
<div class="rev-right">
<img src="<?php echo get_sub_field('review-platform') ?>">
<p><?php echo get_sub_field('review-count'); ?></p>
</div>
</div>
</div>
<?php endif;
// End loop.
endwhile;
endif; ?>
I copied that code to the 'repeater template' instead of default post archive loop, but the shortcode doesn't show my content, maybe someone already used the same decision?
Already tried posts_per_page="4" parameter, it didn't help too.
I am trying to add a box for customers to place a comment on their order.
I've added it to my
/checkout/cart/cart.phtml
You can see I added it here
<div class="cart-collaterals">
<div class="row">
<th><?php echo $this->__('Comments') ?></th>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6">
<?php echo "Any special requirements regarding this order?"; ?>
<!-- COmments box -->
<td class="a-center">
<textarea name="cart[<?php echo $_item->getId() ?>][comments]" rows="3" cols="20"><?php echo $_item->getItemcomment() ?></textarea>
</td>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4">
<?php echo $this->getChildHtml('coupon') ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="cart-totals">
<span id='ajax_loadertotals' style='display:none'><!--<img src='<?php //echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/>--><div class="loaderTotals">Loading...</div></span>
<div class="totals">
<?php echo $this->getChildHtml('totals'); ?>
<?php if(!$this->hasError()): ?>
<ul class="checkout-types">
<?php foreach ($this->getMethods('methods') as $method): ?>
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
<li><?php echo $methodHtml; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
<div id="shipping-info-link">
Delivery & Shipping Information
</div>
</div>
</div>
<?php
echo $this->getLayout()->createBlock('giftcard/checkout_cart_giftcard')->setTemplate('mt/giftcard/checkout/cart/giftcard.phtml')->toHtml();
?>
<?php echo $this->getChildHtml('crosssell') ?>
</div>
Now my problem comprises here:
How can I make it so I (the sales person) can see it on the backend when the order comes through?
I don't mind changing this to the checkout page if it makes it easier. If you could give me some help with it, I'd really appreciate. I've looked around but didn't find anything useful
Thanks
1)Add custom field/attribute in sales_flat_order table using install script, the sample is given below
$installer = $this;
$installer->startSetup();
$installer->getConnection()
->addColumn(
$installer->getTable('sales/order'), 'cutom_comment', 'VARCHAR(150) NOT NULL'
);
$installer->endSetup();
2) Add the field into the checkout page
3) You can use the event "checkout_type_onepage_save_order"
4) you can get the value using Mage::app()->getRequest()->getPost('custom_comment')
5) get the order details using $order = $observer->getEvent()->getOrder();
6) save the order
$order->setCustomComment($comment);
7) add a custom layout for admin
for that ref
8 ) get order details with $order = $this->getOrder()
9) get value by $customComment = "$order->getCustomComment();"
I have a magento multistore website, I need to list all the store and create a link to their home page, for do it I create this template:
<?php $stores = Mage::app()->getWebsite()->getStores();?>
<?php foreach ($stores as $_store): ?>
<div class="store">
<div class="title">
<?php echo $this->htmlEscape($_store->getName()) ?>
</div>
<div class="description">
<p><?php echo Mage::getStoreConfig('design/head/default_description',$_store->getStoreId()); ?></p>
Vai al sito
<a class="link-to-store" href="<?php echo $this->htmlEscape($_store->getHomeUrl())?>">Vai al Negozio</a>
</div>
</div>
<?php endforeach; ?>
the code works until I have 2 store view, intact the code display all 2 view instead only one, there is a way to display only the store and link to correct home page based on current language?
Take a look # Getting a list of magento stores
foreach (Mage::app()->getWebsites() as $website) {
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
foreach ($stores as $_store) {
<div class="store">
<div class="title">
<?php echo $this->htmlEscape($_store->getName()) ?>
</div>
...
</div>
}
}
}
I'm new to Magento and working on customizing the Modern template, as its close to my ultimate design. However I noticed that for some reason the 3rd column in the 3 column template was commented out:
/frontend/default/modern/template/page/3columns.phtml
[lines 43-55]
<div class="main-container col2-left-layout">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<?php /*<div class="col-wrapper">*/ ?>
<div class="col-main">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
<div class="col-left sidebar"><?php echo $this->getChildHtml('left') ?></div>
</div>
<?php /*<div class="col-right sidebar"><?php echo $this->getChildHtml('right') ?></div>*/ ?>
<?php /*</div>*/ ?>
</div>
I copied this to my own theme, and modified it as such:
/frontend/my_package/my_theme/template/page/3columns.phtml
<div class="main-container col3-layout"> <-------
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<div class="col-wrapper"> <-------
<div class="col-main">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
<div cla/ss="col-left sidebar"><?php echo $this->getChildHtml('left') ?></div>
</div>
<div class="col-right sidebar"><?php echo $this->getChildHtml('right') ?></div> <-------
</div> <-------
</div>
<?php echo $this->getChildHtml('footer') ?>
<?php echo $this->getChildHtml('before_body_end') ?>
</div>
In the backend, I created a static block with just plain text, and tried adding it to "All Pages", "Right Column"; but it does not show up. If I add it to "All Pages", "Left Column" it does show up.
I'm guessing that the Right Column reference somehow isn't in Magento correctly, but I don't know where to even begin looking to fix that.
You should have a reference to right column in your page.xml (or your custom local.xml) for it to work.
Check this Classyllama article to see how to implement it in correct way:
http://www.classyllama.com/development/magento-development/the-better-way-to-modify-magento-layout
I am a fairly new user of Yii.. Have been using it for less than 2 months..
I am trying to do a registration form that upon loading, it only shows 2 radio buttons(say choice 1 is Person, choice 2 is Organization), when the user selects a choice i want to dynamically display the fields corresponding to his selection using ajax.
Note: I am using the yii-user extension, and I am intending to use the same table to store both Person & Organization users, since they only differ in 3 attributes.
I have been stuck with this problem for 2 days and am not able to solve it..
This is a snippet of my code:
registration.php (view)
<?php $this->pageTitle=Yii::app()->name . ' - '.UserModule::t("Registration");
$this->breadcrumbs=array(
UserModule::t("Registration"),
);
?>
<h1><?php echo UserModule::t("Registration"); ?></h1>
<?php if(Yii::app()->user->hasFlash('registration')): ?>
<div class="success">
<?php echo Yii::app()->user->getFlash('registration'); ?>
</div>
<?php else: ?>
<div class="form">
<?php $form=$this->beginWidget('UActiveForm', array(
'id'=>'registration-form',
'enableAjaxValidation'=>true,
'disableAjaxValidationAttributes'=>array('RegistrationForm_verifyCode'),
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>
<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>
<?php echo $form->errorSummary(array($model,$profile)); ?>
<div class="row">
<?php echo $form->radioButtonList($model, 'profile_type', array(0=>'Person',1=>'Company'),array('separator'=>'', 'labelOptions'=>array('style'=>'display:inline'), 'onclick' =>CHtml::ajax(array("type"=>"GET", "url"=>array("registration/add"), "data"=>array('test'=>'js:this.value'), "update"=>"#test")))); ?>
</div>
RegistrationController.php
public function actionAdd() {
if(Yii::app()->request->isAjaxRequest){
$this->renderPartial("/user/test",array('model'=>$model),false,true);
Yii::app()->end();
}
}
test.php
<?php
$val = $_GET['test'];
if($val == 1){
echo "yes";
//nothing added yet
}
else{
echo "no";
?>
<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,'email'); ?>
<?php echo $form->textField($model,'email'); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
<p class="hint">
<?php echo UserModule::t("Minimal password length 4 symbols."); ?>
</p>
</div>
<div class="row">
<?php echo $form->labelEx($model,'verifyPassword'); ?>
<?php echo $form->passwordField($model,'verifyPassword'); ?>
<?php echo $form->error($model,'verifyPassword'); ?>
</div>
<?php
}
?>
The erros am recieving when I select Person (choice 0) is the following:
Fatal error: Call to a member function labelEx() on a non-object in test.php
Any help is much appreciated!
The smoking gun is the error Fatal error: Call to a member function labelEx() on a non-object in test.php - it's telling you that labelEx() is not a method. Looking at your view.php, you can see labelEx() is called as a method of $form.
The issue is that when the view test.php is being rendered, it has no idea about the $form you've created in registration.php. test.php only knows about parameters you've passed to it (in this case, only $model).
Instead of using $form->method(), just use CActiveForm::method in your view, e.g.:
<div class="row">
<?php
echo CActiveForm::labelEx($model,'username')
echo CActiveForm::textField($model,'username');
echo CActiveForm::error($model,'username');
?>
</div>
I also combined your consecutive PHP blocks into a single block for easier reading/parsing/etc.