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.
Related
I use Glide JS for a Slideshow that I built with ACF and Gutenberg Blocks.
But there is an issue with the next button. The ">" does not get rendered correctly – and it destroyes the whole DOM. Is there an alternative for the "data-glide-dir" next command? When i remove the data-glide-dir=">" everything works just fine.
Below is the code I use – the screenshot shows how it finally gets rendered in the browser.
screenshot
<?php $gallery = get_field('images'); ?>
<?php if( $gallery ) : ?>
<div class="gcont">
<div class="glide">
<div class="glide__track" data-glide-el="track">
<ul class="glide__slides">
<?php foreach( $gallery as $image ) : ?>
<li class="glide__slide"><img class="full-width-image" src="<?php echo esc_url($image['sizes']['large']); ?>" alt="<?php echo esc_attr($image['alt']); ?>"></li>
<?php endforeach; ?>
</ul>
</div>
<div class="glide__arrows" data-glide-el="controls">
<button class="glide__arrow glide__arrow--prev" data-glide-dir="<">prev</button>
<button class="glide__arrow glide__arrow--next" data-glide-dir=">">next</button>
</div>
</div>
</div>
<?php endif; ?>
What did the trick for me was encoding < with < and > with >
See also: HTML: Should I encode greater than or not? ( > > )
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();"
In a products listing page of magento, i used the masonry and it is working good. But now i want to add a div having some text in the masonry area. I tried this and i get the result, but it break masonry item. My used code...
<?php if ($category_nameplace == round($_collectionSize/2)): ?>
<div class="item">
<h2 class="productcategory-name"><?php echo $this->getLayer()->getCurrentCategory()->getName() ?></h2>
</div>
<?php endif; ?>
This above code is used for insert extra item to the masonry area. In the above code i count the items number and as i got the middle number i insert my div in to bellow written area
<div id="basic" class="products-grid unstyled thubmnails js-masonry">
<?php $category_nameplace = 0; foreach ($_productCollection as $_product): ?>
<?php $category_nameplace++; ?>
<div class="item">
<div class="thumbnail">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(rand(135,400)); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
<div class="caption">
<h2 class="product-name product-info"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
<h2 class="product-info"><?php echo "Dimension:".$_product->getDimension(); ?></h2>
<h2 class="product-info"><?php echo $_product->getPrice(); ?></h2>
</div>
</div>
</div>
<?php endforeach ?>
</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
On this page, I'm trying to move the tags (list of tags and tags form) out of the tabs to the open area immediately before the Reviews section.
I copied everything from the /template/tag/list.phtml to /template/catalog/product/view.phtml:
<div class="box-collateral box-tags">
<h2><?php echo $this->__('Product Tags') ?></h2>
<?php echo $this->getChildHtml('list_before')?>
<?php if( $this->getCount() ): ?>
<h3><?php echo $this->__('Other people marked this product with these tags:') ?></h3>
<ul id="<?php echo $this->getUniqueHtmlId('product-tags_'); ?>" class="product-tags">
<?php echo $this->renderTags('<li>%2$s (%3$s)</li>') ?>
</ul>
<script type="text/javascript">
decorateGeneric($("<?php echo $this->getUniqueHtmlId('product-tags_'); ?>").select('li'), ['first', 'last']);
</script>
<?php endif; ?>
<form id="addTagForm" action="<?php echo $this->getFormAction(); ?>" method="get">
<div class="form-add">
<label for="productTagName"><?php echo $this->__('Add Your Tags:') ?></label>
<div class="input-box">
<input type="text" class="input-text required-entry" name="productTagName" id="productTagName" />
</div>
<button type="button" title="<?php echo $this->__('Add Tags') ?>" class="button" onclick="submitTagForm()">
<span>
<span><?php echo $this->__('Add Tags') ?></span>
</span>
</button>
</div>
</form>
<p class="note"><?php echo $this->__("Use spaces to separate tags. Use single quotes (') for phrases.") ?></p>
<script type="text/javascript">
//<![CDATA[
var addTagFormJs = new VarienForm('addTagForm');
function submitTagForm(){
if(addTagFormJs.validator.validate()) {
addTagFormJs.form.submit();
}
}
//]]>
</script>
</div>
While the form is correctly showing, the tags are not.
I guess it's something to do with the "$this->getCount()". So how can I get $this for tags in view.phtml? Or how can I make this work?
Thanks a lot!
it cannot work if you copied code from template tag/list.phtml to catalog/product/view.phtml because behind of catalog/product/view.phtml is a block which doesnt support same set of methods as block behind tag/list.phtml.
I suggest to move tag_list block inside of product_view block in layout XML. And then in catalog/product/view.phtml you can use something like
<?php echo $this->getChildHtml('tag_list'); ?>
which would print content of tag/list.phtml.
Or if you dont want to move block in layout xmls then you can use something like
<?php echo $this->getLayout()->getBlock('tag_list')->toHtml(); ?>
but it's not so nice and clean :) I suggest to go with option one. Some resources how to work with layout is available in Magento Commerce site.