please visit these links:
configurable product
simple product
in configurable product, i want to move "color" & charactar to top of the page.
i want to move this above "Check Delivery Availability " block.
Means i want this next to text "Age: 2 Years & Above". There is a gap after 4 lines. i want to move color and charactar there.
please help me to find solution.
This is view.phtml
<?php
?>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $pageLayout = str_replace(array('page/','.phtml'),'',Mage::app()->getLayout()->getBlock('root')->getTemplate()); ?>
<?php $_product = $this->getProduct(); ?>
<?php $setting = Mage::helper('em0113settings'); ?>
<script type="text/javascript">
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<div class="Individual">
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="product-view">
<div class="product-essential">
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<?php echo $this->getBlockHtml('formkey') ?>
<div class="no-display">
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
</div>
<div class="product-img-box" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;">
<?php echo $this->getChildHtml('media') ?>
</div>
<?php
$related_product_collection = $_product->getRelatedProductCollection();
$related_product_collection->AddStoreFilter();
$count = count($related_product_collection);
?>
<div class="product-shop <?php if($count > 0 && $pageLayout=='1column'): ?>has-related<?php else: ?>no-related<?php endif ?>">
<div class="product-shop-wrapper <?php if($_product->isGrouped()): ?>grouped<?php endif ?>">
<?php list($_prev_prod, $_next_prod) = Mage::helper('em0113settings/product')->getPreviousNextProducts($this->getProduct()); ?>
<!--<?php if($_prev_prod != NULL): ?>
<?php echo $this->__('Previous') ?>
<?php endif; ?>
<?php if($_next_prod != NULL): ?>
<?php echo $this->__('Next') ?>
<?php endif; ?>-->
<div class="product-name">
<h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
</div>
<?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
<!--<?php if ($this->canEmailToFriend()): ?>
<p class="email-friend"><?php echo $this->__('Email to a Friend') ?></p>
<?php endif; ?>-->
<div class="Pro_des">
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<hr>
<br/>
<!-- <h2><?php echo $this->__('Quick Overview') ?></h2> -->
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
</div>
<?php endif;?>
</div>
<!--
<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock"><span><?php echo $this->__('In of stock') ?></span></p>
<?php else : ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php endif; ?>
-->
<hr class="hr">
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
<hr class="hr">
<div class="check_delivery">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkdelivery/checkdelivery.phtml')->toHtml();?>
</div>
<div class="Quick">
<div class="Quick_1">
<!--<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<h2><?php echo $this->__('Quick Overview') ?></h2>
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
</div>
<?php endif;?>-->
<div class="product-data">
<?php echo $this->getChildHtml('alert_urls') ?>
<?php echo $this->getChildHtml('product_type_data') ?>
<?php echo $this->getChildHtml('extrahint') ?>
<?php echo $this->getTierPriceHtml() ?>
</div>
<?php if (!$this->hasOptions()):?>
<div class="add-to-box">
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php else:?>
<?php echo $this->getChildHtml('addto') ?>
<?php endif; ?>
<!-- <?php if ($_product->isAvailable()) {?>
<div><?php //$buttonTitle = $this->__('Add to Cart'); ?>
<button type="button" title="<?php //echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php //echo $buttonTitle ?></span></span></button>
</div>
<br/>
<div ><button class="button buy-now" onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1'">
<span><span>Buy Now</span></span></button>
</div>
<?php }?>-->
</div>
<?php echo $this->getChildHtml('extra_buttons') ?>
<?php elseif (!$_product->isSaleable()): ?>
<div class="add-to-box">
<?php echo $this->getChildHtml('addto') ?>
</div>
<?php endif; ?>
</div>
<div class="Quick_2">
<!-- Soled By -->
<div class="soled_by">
<?php
$helper=Mage::helper('marketplace');
$_product=Mage::registry('current_product');
$productowner=Mage::getModel('marketplace/product')->isCustomerProduct($_product['entity_id']);
if($productowner['userid']!=""){
$captchenable = $percent = Mage::getStoreConfig('marketplace/marketplace_options/captcha');
$rowsocial=Mage::getModel('marketplace/userprofile')->getPartnerProfileById($productowner['userid']);
}
?>
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
document.write(unescape("%3Cscript src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<div class="soled-by-dealer">
<!--<div class="block-title"><strong><span>
<?php if($rowsocial['shoptitle']!='')
echo $rowsocial['shoptitle'];
else
echo $rowsocial['profileurl']; ?>
</span></strong>
</div>-->
<h5> SOLD BY : </h5>
<span>
<?php if($rowsocial['profileurl'] == "kidsdial2")
{?>
<a href="<?php echo Mage::getUrl('marketplace/seller/collection').$rowsocial['profileurl'] ?>" title="<?php echo "Totaltoys"; ?>" id="siteconnect">
<?php echo "Totaltoys"; ?></a><?php
}
else{?>
<a href="<?php echo Mage::getUrl('marketplace/seller/collection').$rowsocial['profileurl'] ?>" title="<?php echo $rowsocial['profileurl']; ?>" id="siteconnect">
<?php echo $rowsocial['profileurl']; ?></a><?php
}
?>
</span>
</div>
<br/>
<div class="delivery_details">
<div class="COD">
<?php $attribute = $_product->getResource()->getAttribute('cod_available');
$attribute_value = $attribute ->getFrontend()->getValue($_product);
if ($attribute_value == "Yes"){ ?>
<h5> CASH ON DELIVERY </h5>
<div class="Delivery_hover_details">?<p class="killing"><?php echo "Available";?></p></div>
<?php }else{ ?>
<i class="fa fa-times"></i>
<p>
<h5 style="position:relative;bottom: 11px;">CASH ON DELIVERY </h5>
<p class="reduce"><?php echo " Not Available"; ?></p>
</p>
<?php } ?>
<span class="coupontooltip">
<div class="cod_content">
<h5>How do I place a Cash on Delivery (COD) order?</h5>
<p>All items that have the "Cash on Delivery Available" icon are valid for order by Cash on Delivery.</p>
<p>Add the item(s) to your cart and proceed to checkout.When prompted to choose a payment option, select "Cash on Delivery". </p>
<p>Once you place the order you will receive confirmation call from our customer support for validation with in 48 hours. Once verified and confirmed, your order will be processed for shipment in the time specified, from the date of confirmation. You will be required to make a cash-only payment to our courier partner at the time of delivery of your order to complete the payment.</p>
<p>Terms & Conditions</p>
<p>The maximum order value for COD is ₹5000.</p>
<p>e-Gift Vouchers or Store Credit cannot be used for COD orders.</p>
<p>Cash-only payment at the time of delivery.</p>
</div>
</span>
</div>
<div class= "bottom3">
<!-- wholesale available -->
<?php
//$product is your current product
if($_product->getTierPrice()) {
echo "
<div class = 'quickphp'>
<h5>Wholesale</h5>
Available.<br>
Usually Delivered in 10-15 business days.
</div>
";
}
else{
echo "
<div class = 'quickphp'>
<h5>Wholesale</h5>
Not Available.<br>
</div>
";
}
?>
<div class="avail">
<?php if ($this->displayProductStockStatus()): ?>
<?php if($_product->isSaleable()): ?>
<p class="availability in-of-stock"> <h5>Availability</h5> <?php echo $this->__('In Stock') ?></span></p>
<?php else : ?>
<p class="availability out-of-stock"> <h5>Availability</h5> <?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="replace">
<span> <b>7 days</b> Replacement Guarantee</span>
<div class="Delivery_hover_details">?
<span class="coupontooltip">
<h5> How do I return an item purchased on Totaltoys.com</h5>
<p>Conveniently, you can call us at 092-434-22233 and email us at contact#totaltoys.com with order number, invoice number and product name. If you've received an item in a 'Damaged', 'Defective' or 'Not as Described' state.</p>
<h5>Return & Replacement policy:</h5>
<p>Returns or replacement request should be placed within 7 days from the date of delivery.</p>
<p>As we receive your request, our concerned team will contact you to validate the compliant. The validation process may require submitting of product photos. Once the validation process is completed then further action will be taken.
Once the product reaches to us/seller, the replacement will be proceed in 1-2 working days after physical inspection of the goods and shipment will be done simultaneously.</p>
<p>If you've received an item in a 'Damaged', 'Defective' or 'Not as Described' state, all replacements/pickups will be done free of cost.</p>
<p>If the packaging is tampered with or damaged, before accepting delivery of the goods, please refuse to take delivery of the package, and call us on 092-434-22233 or mail us at contact#totaltoys.com , mentioning your order reference number. We shall make our best efforts to ensure that a replacement delivery is made to you at the earliest.</p>
<p>In the rare circumstances where a pickup cannot be done, you can ship the product through any courier. You will be reimbursed the shipping charges against the original receipt.</p>
<p>Replacement is subjected to availability of stock. In case a replacement is not available, the amount will be refunded to your account from which the purchase was made. (Amount includes shipping and gift wrapping charges)</p>
<h5> Return Request is not Accepted If:</h5>
<li>Return request is made outside the specified time period</li>
<li>Missing of tags, labels, original packing, and invoice.</li>
<li>Misused or Mishandle of the product from customer end.</li>
<p>For all refunds we will refund the amount to same mode of payment as used during checkout. Refunds for cash on delivery will be made via online transfer of funds to the customers bank account.</p>
<p>If the customer chooses to cancel the order before the product is shipped, he will be entitled to a 100% refund.
Do I have to return the free gift when I return a product?</p>
<p>Yes. The free gift is included as part of the item order and needs to be returned along with the originally delivered product</p>
<p>Please contact us on contact#totaltoys.com or call us at 092-434-22233 for any doubts and concerns</p>
</span>
</div>
</div>
</div>
</div>
<div class="Delivery">
<h5> Delivered By </h5>
<div class="Delivery_hover_details">?
<span class="coupontooltip">
<div class="delivery_content">
<h5>What is the estimated delivery time?</h5>
<p>Sellers generally procure and ship the items within the time specified on the product page. Business days exclude public holidays and Sundays.</p>
<p>Estimated delivery time depends on the following factors:
<li>Time of the order, usually orders made after 2:00pm can be shipped only on next workingday</li>
<li>The Seller offering the product</li>
<li>Product's availability with the Seller</li>
<li>The destination to which you want the order shipped to and the Seller's location</li></p>
</div>
</span>
</div>
<ul class="fk-ul-disc">
<li>Usually Delivered in 3-5 business days.</li>
<li> Delivery Time may exceed than usual due to Festival Holidays</li>
</ul>
</div>
</div>
</div>
<!--<?php if (!$this->hasOptions()):?>
<div class="add-to-box">
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php else:?>
<?php echo $this->getChildHtml('addto') ?>
<?php endif; ?>
</div>
<?php echo $this->getChildHtml('extra_buttons') ?>
<?php elseif (!$_product->isSaleable()): ?>
<div class="add-to-box">
<?php echo $this->getChildHtml('addto') ?>
</div>
<?php endif; ?>-->
<?php echo $this->getChildHtml('other');?>
<?php echo $this->getChildHtml('short_des_after'); ?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
<?php echo $this->getChildHtml('shippingreturns') ?>
</div>
</div>
<!--<span class="or_buy_now"> -- OR --</span>-->
<!--<button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>-->
<!-- Buy Now -->
<div class="clearer"></div>
</form>
</div>
<!-- Add button share facebook -->
<?php if ($setting->getImageProduct_ViewSocial()): ?>
<div id="social-share" class="hide-lte0 hide-lte1 hide-lte2"></div>
<script type="text/javascript">
jQuery(document).ready(function($){
jQuery('#social-share').dcSocialShare({
buttons: 'facebook,plusone,twitter,pinterest',
twitterId: 'designchemical',
email: 'moc//niamod/liame',
align: 'right',
floater: false
});
});
</script>
<?php endif; ?>
<script type="text/javascript">
//<![CDATA[
var productAddToCartForm = new VarienForm('product_addtocart_form');
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;
if (url) {
form.action = url;
}
var e = null;
try {
this.form.submit();
} catch (e) {
}
this.form.action = oldUrl;
if (e) {
throw e;
}
if (button && button != 'undefined') {
button.disabled = true;
}
}
}.bind(productAddToCartForm);
productAddToCartForm.submitLight = function(button, url){
if(this.validator) {
var nv = Validation.methods;
delete Validation.methods['required-entry'];
delete Validation.methods['validate-one-required'];
delete Validation.methods['validate-one-required-by-name'];
// Remove custom datetime validators
for (var methodName in Validation.methods) {
if (methodName.match(/^validate-datetime-.*/i)) {
delete Validation.methods[methodName];
}
}
if (this.validator.validate()) {
if (url) {
this.form.action = url;
}
this.form.submit();
}
Object.extend(Validation.methods, nv);
}
}.bind(productAddToCartForm);
//]]>
</script>
</div>
<div class="product-collateral">
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
<div class="box-collateral <?php echo "box-{$alias}"?>">
<?php if ($title = $this->getChildData($alias, 'title')):?>
<h2><?php echo $this->escapeHtml($title); ?></h2>
<?php endif;?>
<?php echo $html; ?>
</div>
<?php endforeach;?>
<?php echo $this->getChildHtml('product_additional_data') ?>
<?php echo $this->getChildHtml('product_additional_collateral') ?>
</div>
<?php echo $this->getChildHtml('catalog.product.related'); ?>
<?php echo $this->getChildHtml('review_list') ?>
<?php echo $this->getChildHtml('upsell_products') ?>
<?php if (Mage::helper('em0113settings')->getImageProduct_UseTabs()): ?>
<script type="text/javascript">
//<![CDATA[
jQuery(window).ready(function() {
setTimeout(function() {
timeout = null;
EM.tools.decorateProductCollateralTabs();
}, 200);
});
//]]>
</script>
<?php endif ?>
</div>
<!-- mobile -->
<div class="set">
<?php $attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$product=Mage::getModel('catalog/product')->load($_product->getId());
$attributeSetModel->load($product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
if($attributeSetName=='Mobile'){ echo $this->__('color may vary as shown in above image'); } ?>
</div>
<!-- mobile end-->
<style>
.reduce {
clear: both;
float: left;
bottom: 13px;
border-radius: 2px;
color: #666;
display: inline-block;
font-size: 11px;
height: 0px;
line-height: 6px;
position: relative;
text-align: center;
text-decoration: none;
}
.set {
position:relative;
bottom:950px;
}
</style>
Why do you want to move it using CSS, when you can move it via phtml file code.
Search for the below code:
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
MOVE and place this just BEFORE:
<div class="check_delivery">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkdelivery/checkdelivery.phtml')->toHtml();?>
</div>
So your code will now look like:
<hr class="hr">
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
<hr class="hr">
<div class="check_delivery">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkdelivery/checkdelivery.phtml')->toHtml();?>
</div>
After you have done this, CLEAR CACHE - Delete /var/cache and /var/full_page_cache (if applicable) folders.
Few additional inputs about your code, there are Magento Standard ways of coding which MUST be followed for best practices.
1. Like for example, you might want to clean up the code. Magento's recommendation is to use the below way of coding when adding any CONTENT via phtml files.
<?php echo $this->__('Your Content'); ?> //this is called TRANSLATION in Magento
This means, you should be doing something like this:
<span class="coupontooltip">
<div class="cod_content">
<h5><?php echo $this->__('How do I place a Cash on Delivery (COD) order?'); ?></h5>
...
...
..
</div>
</span>
This TRANSLATION helps when you are creating websites with a different locale.
2. Secondly, Recommendation for commenting out lines.
DO NOT comment out code using HTML comments. Use as below:
Single line comment
<?php //<b>Strong</b> ?>
Multi line comment
<?php /*<b>Strong</b>*/ ?>
3. DO NOT write CSS in the same phtml file
Use styles.css under /skin/frontend/yourpackage/youtheme/css folder
[Editing answer based on the modifications required]
Look for catalog.xml file inside /app/design/frontend/yourpackage/yourtheme/layout folder, Search for as="container2"
<catalog_product_view translate="label">
...
...
...
<block type="core/template_facade" name="product.info.container2" as="container2">
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
<action method="append"><block>product.info.options.wrapper</block></action>
<!--action method="append"><block>product.info.options.wrapper.bottom</block></action>
</block--> <!--comment out this line-->
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
</block>
...
</catalog_product_view>
To move the COLOR and CHARACTER dropdowns/options next to each other, update the code this way:
<div class="desc-options"> //add new div
<div class="Pro_des">
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<hr>
<br/>
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>
</div>
</div>
<?php endif;?>
</div>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
</div>
Remove below code block from above "Check Delivery ..."
<hr class="hr">
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>
Add CSS as below
styles.css line no: 1021, search for ".product-options"
Change the width: 100% to width: 50%;
In THEME CSS do the below:
.product-view .short-description { width: 50%; float:left; }
dl dt {
font-weight: bold;
display: block;
margin: 0 0 .5em;
}
.product-options dd {
margin: 4px 0;
display: inline-block;
}
To move ADD TO CART and BUY NOW buttons as Simple Product, update your code this way:
<div class="Quick_1">
<div class="product-data">
<?php echo $this->getChildHtml('alert_urls') ?>
<?php echo $this->getChildHtml('product_type_data') ?>
<?php echo $this->getChildHtml('extrahint') ?>
<?php echo $this->getTierPriceHtml() ?>
<?php echo $this->getChildHtml('product.info.options.wrapper.bottom') ?> // add this line
</div>
Let me know if this helps.
Happy Coding...
Related
http://dev.factorydirectmedical.com/wheelchairs?mode=grid this is my product page and I want to resize the images. I used Magento developer option to hint the template path. Here a screenshot, (http://www.awesomescreenshot.com/image/1645297/4998c8379ebab36e77cab59c1a9c3bd5), I found the HTML file but I'm unable to fix this image box.
List.phtml
<?php
/**
* #package be
* #copyright Copyright (c) 2010-2015 MeigeeTeam. (http://www.meigeeteam.com)
*/
?>
<?php
/**
* Product list template
*
* #see Mage_Catalog_Block_Product_List
*/
?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
$meigeeOptions = $this->getLayout();
$gridColumns = $meigeeOptions->getMConfigResultByAlias('listing_columns');
$productType = $meigeeOptions->getMConfigResultByAlias('listing_product_type');
$listType = $meigeeOptions->getMConfigResultByAlias('listing_list_type');
$grid_indents = $meigeeOptions->getMConfigResultByAlias('listing_indents');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php echo $this->getToolbarHtml() ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<ol class="products-list" id="products-list">
<?php foreach ($_productCollection as $_product): ?>
<?php echo $this->getLayout()->createBlock('page/html')->setProductInfo($_product)->setProductList($this)->setIterator($this)->setTemplate($listType)->toHtml(); ?>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
<?php else: ?>
<?php // Grid Mode ?>
<ul class="products-grid row <?php echo $gridColumns.''.($grid_indents != 1 ? ' no-indents' : ''); ?>">
<?php foreach ($_productCollection as $_product): ?>
<?php echo $this->getLayout()->createBlock('page/html')->setProductInfo($_product)->setProductList($this)->setTemplate($productType)->toHtml(); ?>
<?php endforeach ?>
</ul>
<script type="text/javascript">
decorateGeneric($$('ul.products-grid'), ['odd','even','first','last']);
</script>
<?php endif; ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarHtml() ?>
</div>
<script type="text/javascript">
jQuery(window).load(function(){
function buttonsSize(){
if(jQuery('.category-products li.item').length){
jQuery('.category-products li.item').each(function(){
itemsCount = jQuery(this).find('.image-box .actions').children().length;
switch(itemsCount) {
case 1:
itemsCountClass = 'one-item';
break;
case 2:
itemsCountClass = 'two-items';
break;
case 3:
itemsCountClass = 'three-items';
break;
case 4:
itemsCountClass = 'four-items';
break;
default:
itemsCountClass = 'four-items';
break;
}
jQuery(this).find('.image-box .actions').addClass(itemsCountClass);
});
}
}
buttonsSize();
jQuery(window).resize(function(){
buttonsSize();
});
if('undefined' != typeof GeneralToolbar) {
buttonsSize();
}
GeneralToolbar.onInit = function(){
buttonsSize();
}
});
</script>
<?php if(Mage::app()->getLayout()->getBlock('ajaxkit')->issetSubmodulesConfig('general_toolbar')) { ?>
<div class="infinite-scroll-elements">
<div class="infinite-scroll-loader"><div></div></div>
<div class="infinite-scroll-button" id="StaticScrollBtn"><?php echo $this->__('Show More Products'); ?></div>
</div>
<?php } ?>
</div>
<?php endif; ?>
<?php
// Provides a block where additional page components may be attached, primarily good for in-page JavaScript
if ($this->getChild('after')){
$_afterChildren = $this->getChild('after')->getSortedChildren();
foreach ($_afterChildren as $_afterChildName){
$_afterChild = $this->getChild('after')->getChild($_afterChildName);
//set product collection on after blocks
$_afterChild->setProductCollection($_productCollection);
echo $_afterChild->toHtml();
}
}
?>
new.phtml
<?php
/**
* #package be
* #copyright Copyright (c) 2010-2015 MeigeeTeam. (http://www.meigeeteam.com)
*/
$meigeeOptions = $this->getLayout();
$lightBox = $meigeeOptions->getMConfigResultByAlias('lightbox_listing');
$timerStatus = $meigeeOptions->getMConfigResultByAlias('timer_status');
$timerListingStatus = $meigeeOptions->getMConfigResultByAlias('timer_listing_status');
$catalogModeWrapper = $meigeeOptions->getMConfigResultByAlias('catalog_mode');
$catalogMode = $catalogModeWrapper['value']['sv2']['value'];
?>
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="row">
<div class="widget widget-new-products clearfix">
<div class="col-xs-12">
<header class="widget-title">
<h2><?php echo $this->__('New Products') ?></h2>
</header>
</div>
<div class="widget-products col-xs-12">
<?php echo $this->getPagerHtml() ?>
<div class="row">
<ul class="products-grid clearfix">
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
<li class="item col-xs-6 col-sm-3">
<div class="image-box">
<?php if($lightBox){ ?>
<a href="<?php echo $_product->getProductMediaResized(930, 'small_image')->getImageSrc(); ?>" data-toggle="lightbox" class="lightbox-button" data-footer="<?php echo $this->stripTags($_product->getName(), null, true) ?>" title="<?php echo $this->__('Lightbox'); ?>">
<i class="icon-search"></i>
</a>
<?php } ?>
<?php echo $this->getLayout()->createBlock('page/html')->setProductInfo($_product)->setTemplate('catalog/product/product_labels.phtml')->toHtml(); ?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image">
<span class="mask"></span>
<?php
echo $_product->productHoverImage($this, 800);
$escaped_label = $this->stripTags($_product->getName(), null, true);
echo '<img '. $_product->getProductMediaResized(800, 'small_image')
->addImageHtmlAttributte('alt', $escaped_label)
->addImageHtmlAttributte('title', $escaped_label)
->getImageHtmlAttributte().' />';
?>
</a>
<div class="actions clearfix">
<?php if ($_product->isSaleable()): ?>
<?php if($catalogMode == 0) { ?>
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')); ?>" class="btn btn-default pull-left" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><i class="icon-basket"></i></span></span></button>
<?php } ?>
<?php else: ?>
<a class="btn btn-default" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Read More')); ?>"><i class="icon-link"></i></a>
<?php endif; ?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<span class="link-wishlist-wrapper"><i class="icon-heart-fa"></i></span>
<?php endif; ?>
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
<span class="link-compare-wrapper"><i class="icon-shuffle"></i></span>
<?php endif; ?>
</div>
</div>
<h3 class="product-name"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></h3>
<?php if($_product->isSaleable()): ?>
<p class="availability in-stock"><i class="icon-record"></i><?php echo $this->__('Product') ?> <span><?php echo $this->__('In stock') ?></span></p>
<?php else: ?>
<p class="availability out-of-stock"><i class="icon-record"></i><?php echo $this->__('Product') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php echo $this->getPriceHtml($_product, true, '-new') ?>
<?php if($timerStatus && $timerListingStatus) {
echo $this->getLayout()->createBlock('page/html')->setProduct($_product)->setTemplate('catalog/product/listing_timer.phtml')->toHtml();
} ?>
<hr class="indent-18 white-space"/>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
</div>
<?php endif; ?>
Images come from list.phtml
There may use other method to get this image. if you unable to find image then please provide me list.phtml file code
Im not really familiar with Magento and i need to remove zoom effect from product image.
This is the code from /catalog/product/view/media.phtml inside template directory.
I tried to play around with if-else statement, but it seems im missing something because i am getting errors.
Is anybody more familiar with this to take a look?
Thanks a bunch!
<div class="product-image">
<?php if ($scrollStatus): ?>
<div id="jp-container" class="jp-container" style="height:500px;">
<a href="javascript:void(0);"><?php
$_img = '<img src="'.$helpImg->getImg($_product, 'image', $imgSize, null).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
echo $_img;
?></a>
<?php foreach ($this->getGalleryImages() as $_image): ?>
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
<?php endforeach; ?>
</div>
<script type="text/javascript">
jQuery(window).load(function(){
function jspaneStart(){
setTimeout(function(){
maxHeight = 0;
jQuery('#jp-container a').each(function(){
if(jQuery(this).height() > maxHeight){
maxHeight = jQuery(this).height();
}
});
maxHeight = maxHeight+(maxHeight/100)*<?php echo $scrollimagesHeight; ?>;
jQuery('#jp-container').css('height', maxHeight);
jQuery('#jp-container').jScrollPane();
}, 500);
}
jspaneStart();
jQuery(window).resize(function(){
jspaneStart();
});
});
</script>
<?php else: ?>
<a id='zoom' class="cloud-zoom" data-zoom="showTitle: false, adjustX: -5, adjustY:-5, tint: '#fff', tintOpacity:0.6, position:'inside'" href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>"><?php
$_img = '<img id="image" src="'.$helpImg->getImg($_product, 'image', $imgSize, null).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
?></a>
<?php /* Label New */ echo MAGE::helper('ThemeOptionsMinimalism')->getProductLabels($_product); ?>
<?php if (count($this->getGalleryImages()) > 0): ?>
<div class="more-views-container">
<div class="more-views<?php if ($productpage_moreviews == 'moreviews_slider' && count($this->getGalleryImages()) > 3){echo ' slider-on';} ?>">
<h2><?php echo $this->__('More Views') ?></h2>
<?php if ($productpage_moreviews == 'moreviews_slider' && count($this->getGalleryImages()) > 3): ?>
<div id="more-views-slider" class="es-carousel-wrapper">
<ul class="carousel-ul">
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a class='cloud-zoom-gallery' data-zoom="useZoom: 'zoom', smallImage: '<?php echo $helpImg->getImg($_product, 'thumbnail', $imgSize, null, $_image->getFile()); ?>' " href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img <?php echo $helpImg->getImgSources($_product, 'thumbnail', 200, null, $_image->getFile()); ?> alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class = 'next'><i class="fa fa-angle-right"></i></div>
<div class = 'prev unselectable'><i class="fa fa-angle-left"></i></div>
<?php else: ?>
<ul class="no-slider">
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a class='cloud-zoom-gallery' data-zoom="useZoom: 'zoom', smallImage: '<?php echo $helpImg->getImg($_product, 'thumbnail', $imgSize, null, $_image->getFile()); ?>' " href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img <?php echo $helpImg->getImgSources($_product, 'thumbnail', 200, null, $_image->getFile()); ?> alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->displayProductStockStatus()): ?>
<?php if ($_product->isAvailable()): ?>
<p class="availability in-stock"><i class="fa fa-check"></i><?php echo $this->__('In stock') ?></p>
<?php else: ?>
<p class="availability out-of-stock"><i class="fa fa-times"></i><?php echo $this->__('Out of stock') ?></p>
<?php endif; ?>
<?php endif; ?>
</div>
You can disable zoom from magento js.
just locate this file js\varien\product.js and comment this line
Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this));
this line is responsible for image zoom by default.
Go to Admin, then to System -> Configuration.Then go to Manage -> Advanced -> Disable Modules Output -> EcommerceTeam_CloudZoom -> Disable. Click Save Config.
then Go to
System -> Configuration ->Catalog
On the next page under Cloud Image Zoom you will find a list of options to configure the module.
Enable Cloud Zoom – when no is selected, the option disables the Cloud Zoom in your product images.
Click ‘Save Config’ at the top right when you are done.
You could always try disabling the module completely via the module's xml file in app/etc/modules
Your xml file that relates to the zoom module will look something like this:
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<module_name>
<active>true</active>
<codePool>community</codePool>
</module_name>
</modules>
</config>
Simply set active to false
This answer worked for me:
Add JS in media.phtml in your theme.
// ProductMediaManager is outside document.read scope
if (typeof ProductMediaManager !== 'undefined') {
// Override image zoom in /skin/frontend/rwd/default/js/app.js
// and prevent the zooming of images on hover
ProductMediaManager.createZoom = function(image) { return; }
}
I have found the answer form here
Thanks "Patrick Ward" for the great and simple Solution...
I already have an existing page which I'm trying to turn into a Magento website. One the pages I'm working on makes use of Lightbox. I tried including the lightbox file through Design in the CMS Page. Same for content but it didn't work there. Is there any way I can include the lightbox javascript from the previous website without having to touch the xml, html and php files? How do I make the lightbox work on the website?
You can always add a javascript file to the page's head by adding the following to the design tab of your CMS page (note that the path is relative to the root js directory). However, if you plan on using lightbox on multiple pages, this would not be the preferred method because you'd have to copy this into the design tab of every page you needed it on.
<reference name="head">
<action method="addJs"><js>custom/lightboxjs</js></action>
</reference>
View.PHTML
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<script type="text/javascript">
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<?php $config = Mage::getStoreConfig('mdloption/product-type-option'); ?>
<?php if($config['product-view-option'] !=2 && $config['product-view-option'] !=3): ?>
<?php $classnNum ='span9'?>
<?php else:?>
<?php $classnNum ='f-fix'?>
<?php endif; ?>
<?php if($config['product-view-option']==3):?>
<?php $classnNum2 = 'left-carousel'?>
<?php endif; ?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="product-view <?php echo $classnNum; ?>">
<!--<a class="prePage" href="<?php //echo $_SESSION['core']['last_url'];?>"><?php //echo $this->__('Return to Previous Page')?></a>-->
<!--Prev/Next Code Start-->
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
$prev_url = $next_url = $url = $_product->getProductUrl();
if ($this->helper('catalog/data')->getCategory()) {
$category = $this->helper('catalog/data')->getCategory();
} else {
$_ccats = $this->helper('catalog/data')->getProduct()->getCategoryIds();
$category = Mage::getModel('catalog/category')->load($_ccats[0]);
}
$children = $category->getProductCollection();
$_count = is_array($children) ? count($children) : $children->count();
if ($_count) {
foreach ($children as $product) {
$plist[] = $product->getId();
}
$current_pid = $this->helper('catalog/data')->getProduct()->getId();
$curpos = array_search($current_pid, $plist);
$previd = isset($plist[$curpos+1])? $plist[$curpos+1] : $current_pid;
$product = Mage::getModel('catalog/product')->load($previd);
$prevpos = $curpos;
while (!$product->isVisibleInCatalog()) {
$prevpos += 1;
$nextid = isset($plist[$prevpos])? $plist[$prevpos] : $current_pid;
$product = Mage::getModel('catalog/product')->load($nextid);
}
$prev_url = $product->getProductUrl();
$nextid = isset($plist[$curpos-1])? $plist[$curpos-1] : $current_pid;
$product = Mage::getModel('catalog/product')->load($nextid);
$nextpos = $curpos;
while (!$product->isVisibleInCatalog()) {
$nextpos -= 1;
$nextid = isset($plist[$nextpos])? $plist[$nextpos] : $current_pid;
$product = Mage::getModel('catalog/product')->load($nextid);
}
$next_url = $product->getProductUrl();
}
?>
<!--Prev/Next Code End-->
<div class="product-essential">
<div class="product-img-box span6 <?php echo $classnNum2;?>"> <?php echo $this->getChildHtml('media') ?> </div>
<div class="productDetailBox span6">
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<div class="no-display">
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input type="hidden" name="related_product" id="related-products-field_1" value="" />
</div>
<div class="product-shop">
<div class="product_left f-fix">
<div class="nextPre">
<!-- <a rel="tooltip" data-placement="left" title="<?php echo $this->__('No Products')?>" class="prod-prev disable" href="JavaScript:void(0);">Prev</a>
<a rel="tooltip" data-placement="right" title="<?php echo $this->__('No Products')?>" class="prod-next disable" href="JavaScript:void(0);">NEXT</a>-->
<?php if ($url <> $prev_url):?>
<a class="prod-next" rel="tooltip" data-placement="right" title="<?php echo $this->__('Volgende product')?>" href="<?php echo $prev_url; ?>"><i class="fa fa-angle-right"></i></a>
<?php endif; ?>
<?php if ($url <> $next_url):?>
<a rel="tooltip" data-placement="left" title="<?php echo $this->__('Vorige product')?>" class="prod-prev" href="<?php echo $next_url; ?>"><i class="fa fa-angle-left"></i></a>
<?php endif; ?>
</div>
<div class="product-name">
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>
<div class="review"> <?php echo $this->getReviewsSummaryHtml($_product, false, true)?> </div>
<div class="stock_box">
<?php if ($_product->isAvailable()): ?>
<p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('<i class="fa fa-check-circle"></i> Beschikbaar') ?></span></p>
<?php else: ?>
<p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('<i class="fa fa-times-circle"></i> Verkocht') ?></span></p>
<?php endif; ?>
</div>
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
</div>
<?php endif;?>
<div class="pro-left">
<div class="add_to_cart">
<?php if (!$this->hasOptions()):?>
<div class="add-to-box">
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php endif; ?>
<div class="price_box">
<?php echo $this->getChildHtml('alert_urls') ?>
<?php echo $this->getChildHtml('product_type_data') ?>
<?php echo $this->getTierPriceHtml()?>
</div>
</div>
<?php endif; ?>
<?php echo $this->getChildHtml('other');?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
<?php endif;?>
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<div class="price_box">
<?php echo $this->getChildHtml('alert_urls') ?>
<?php echo $this->getChildHtml('product_type_data') ?>
<?php echo $this->getTierPriceHtml()?>
</div>
<?php endif;?>
<div class="clear"></div>
</div>
<div class="f-fix">
<?php echo $this->getChildHtml('extrahint') ?>
<?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
<?php endif; ?>
<?php echo $this->getChildHtml('addto') ?>
<?php if ($this->canEmailToFriend()): ?>
<p class="email-friend"><a rel="tooltip" data-placement="top" title="<?php echo $this->__('Email to a Friend') ?>" href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><i class="fa fa-envelope"></i> <?php echo $this->__('Email to a Friend') ?></a></p>
<?php endif; ?>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4f74bbe87b978120"></script>
<!-- AddThis Button END -->
</div>
</div>
</div>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('static_links')->toHtml() ?>
</div>
</form>
</div>
<div class="product-collateral" id="tabs">
<?php echo $this->getChildHtml('info_tabs') ?>
</div>
</div>
</div>
<?php if($config['product-view-option'] !=2 && $config['product-view-option'] !=3): ?>
<div class="product_right span3">
<?php $config = Mage::getStoreConfig('mdloption/upsellsetting'); ?>
<?php if($config['upsellblocks']==1):?>
<?php echo $this->getChildHtml('upsell_products'); ?>
<?php elseif($config['upsellblocks']==2):?>
<?php if($_product->getUpsellProducts()): ?>
<?php echo $this->getChildHtml('upsell_products'); ?>
<?php else: ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('productBanner')->toHtml() ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('product_custom_block')->toHtml() ?>
<?php endif ?>
<?php elseif($config['upsellblocks']==3):?>
<?php echo $this->getChildHtml('upsell_products'); ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('productBanner')->toHtml() ?>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('product_custom_block')->toHtml() ?>
<?php endif;?>
<div class="staticSidebar">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('product-static-box')->toHtml() ?>
</div>
</div>
<?php endif; ?>
<?php //echo $this->getChildHtml('upsell_products'); ?>
<?php //echo $this->getChildHtml('related'); ?>
<script type="text/javascript">
//<![CDATA[
var productAddToCartForm = new VarienForm('product_addtocart_form');
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;
if (url) {
form.action = url;
}
var e = null;
try {
this.form.submit();
} catch (e) {
}
this.form.action = oldUrl;
if (e) {
throw e;
}
if (button && button != 'undefined') {
button.disabled = true;
}
}
}.bind(productAddToCartForm);
productAddToCartForm.submitLight = function(button, url){
if(this.validator) {
var nv = Validation.methods;
delete Validation.methods['required-entry'];
delete Validation.methods['validate-one-required'];
delete Validation.methods['validate-one-required-by-name'];
// Remove custom datetime validators
for (var methodName in Validation.methods) {
if (methodName.match(/^validate-datetime-.*/i)) {
delete Validation.methods[methodName];
}
}
if (this.validator.validate()) {
if (url) {
this.form.action = url;
}
this.form.submit();
}
Object.extend(Validation.methods, nv);
}
}.bind(productAddToCartForm);
//]]>
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("a[rel=example_group]").fancybox({
hideOnContentClick : true,
showNavArrows : false,
arrows : false,
showTitle : false,
scrolling : 'no',
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
});
</script>
I'm trying to get sample file url for a downloadable product in my cross sell block on a product page.
The contents of my crosssell.phtml
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?>
<div id="music-crosssell-modal" style="display:none;">
<div class="modal-inner">
<span id="music-crosssell-header">Featured Music</span>
<ul id="music-crosssell-products-list">
<?php foreach ($_crossSellProducts as $_item): ?>
<?php $_item = Mage::getModel('catalog/product')->load($_item->getId()); ?>
<li class="music-item paused" id="<?php echo urlencode($this->htmlEscape($_item->getSongTitle())) ?>">
<span class="player">Loading...</span>
<span class="track-title"><?php echo $this->htmlEscape($_item->getSongTitle()) ?> by </span> <span class="music-track-artist"><?php echo $this->htmlEscape($_item->getMusicianName()) ?></span>
<button type="button" title="<?php echo $this->__('Buy Now') ?>" class="button btn-primary" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')">
<?php echo $this->__('Buy Now') ?>
</button>
</li>
<?php
$_myprodsamples = Mage::getModel('downloadable/sample');
$_mySampleCollection = $_myprodsamples->getCollection()
->addProductToFilter($_item->getId());
?>
<?php
foreach ($_mySampleCollection as $_sample):
$_samplelink = $this->getUrl('downloadable/download/sample/sample_id/'.$_sample->getId());
?>
<?php echo Mage::getModel('downloadable/sample')->load($_samplelink)->getUrl() ?>
<script type="text/javascript">
jwplayer("#<?php echo urlencode($this->htmlEscape($_item->getSongTitle())) ?> .player").setup({
flashplayer: "/skin/frontend/default/datura/js/jwplayer/player.swf') ?>",
file: "<?php echo Mage::getModel('downloadable/sample')->load($sampleId)->getUrl() ?>",
height: 25,
width: 25,
controlbar: "bottom"
});
</script>
<?php
endforeach;
?>
<script type="text/javascript">
jwplayer("#<?php echo urlencode($this->htmlEscape($_item->getSongTitle())) ?>").setup({
flashplayer: "/skin/frontend/default/datura/js/jwplayer/player.swf') ?>",
file: "",
height: 25,
width: 300,
controlbar: "bottom"
});
</script>
<?php endforeach; ?>
</ul>
</div>
<span id="music-crosssell-close-btn" class="close-modal-btn">X</span>
</div>
<?php endif; ?>
You can try this :
$_myprodsamples = Mage::getModel('downloadable/link');
$_mySampleCollection = $_myprodsamples->getCollection()
->addProductToFilter($_product->getId());
foreach ($_mySampleCollection as $_sample){
echo $_samplelink = $this->getUrl('downloadable/download/linkSample/link_id/'.$_sample ->getId());
}
I hope this will work for you
You can also get sample data array using
<?php $sampleColl = Mage_Downloadable_Block_Catalog_Product_Samples::getSamples($_product);
foreach ($sampleColl as $_sample){
echo "<pre>";
print_r($_sample);
}
?>
I hope this will help you
When I load a productcollection in list.phtml for the first time (or when I turn of caching completely) the products that are returned are the products which reside in the category which was created last (i.e. the category with the highest id). When cache is turned on, on page-refresh the correct products are shown. After the cache is deleted, the same situation occurs (for the correct products to show I need to refresh the page once when the productlisting is shown).
One extra strange thing; If I call
$_product->getCategory()->getName()
the correct categoryname is returned, but when
$_product->getName()
is called, the wrong productname returns... Im at a complete loss here. I have read a similar post elsewhere which stated that when cache is turned on, this problem goes away, but only after the first page-refresh which is highly undesirable.
<?php $_coreHelper = $this->helper('core'); ?>
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); ?>
<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); ?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = 4; ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php echo var_dump($_product->getCategory()->getName()); ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid" style="padding-left:0px;">
<?php endif ?>
<li style="height:230px;" class="hreview-aggregate hproduct item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<h2 class="item fn product-name">
<?php echo substr($this->htmlEscape($_product->getName()), 0, 22).'...' ?>
</h2>
<div>
<div>
<img class="photo fn" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(100); ?>" width="100" height="100" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
</div>
<div style="clear:both"></div>
</div>
<div>
<div>
<div>
<div>
<div><span style="font-size:13px;font-weight:bold;"><?php echo $_coreHelper->currency($newprice,true,false) ?> <?php echo $this->helper('tax')->__('Ex. BTW') ?></span></div><br />
<div><?php echo $_coreHelper->currency($newtaxprice,true,false) ?> <?php echo $this->helper('tax')->__('Inc. BTW') ?></div>
</div>
</div>
<div style="clear:both;"></div>
<br />
<form action="<?=$this->getAddToCartUrl($_product);?>" method="post" id="product_addtocart_form_<?=$_product->getId();?>" <?if($_product->getOptions()){?> enctype="multipart/form-data"<?}?>>
<?if(!$_product->isGrouped()){?>
<input type="text" name="qty" id="qty" maxlength="12" value="<?echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1);?>" style="width:30px;" /> x
<?}?>
<button type="button" class="button-order" onclick="this.form.submit()"><span><span><?=$this->__('Bestellen');?></span></span></button>
<br /><br />
<span>Zet in verlanglijst</span>
</form>
</div>
</div>
<div style="clear:both"></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; ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarHtml() ?>
</div>
</div>
Re-Index all your products in re-indexing page.
Clear your cache.
Reload your products page.