Remove standard title from Magento bundled products - magento

Hope anybody can help me on this matter.
I want to delete the standard title from the bundled products, but I can not find where to do this.
Help is appreciated.
Thanks and regards
Extra information
In my email confirmation I see:
Test Bundled products (= product name)
[title]
1x Product A - € 5.00 SKU1
[title]
1x Product B - € 5.00 SKU2
I already cleared the price in /app/code/local/Mage/Bundle/Block/Sales/Orders/Items/Renderer.php, but the [title] must be hidden or gone in my email notification so it finally looks like this:
1x Product A - € 5.00 SKU1
1x Product B - € 5.00 SKU2

Hello you can change product meta title check below path
Admin->Catalog->manage products->select particular product->meta information -> add meta title -> save

In your phtml template you can replace:
<?php echo $this->getSelectionQtyTitlePrice($_selection) ?>
with
<?php echo $this->escapeHtml($_selection->getName()); ?>
<span class="price-notice">
<span class="price">
+ <?php echo $this->formatPriceString($_selection->getPrice()); ?>
</span>
</span>

Related

Prestashop: How translate "Featured Products"?

Module: Ortho Theme Featured products
File:
modules/otfeaturedproducts/views/templates/hook/otfeaturedproducts.tpl
Code:
<h1 class="main-title">
{l s='Featured Products' d='Modules.Featuredproducts.Shop'}
</h1>
I tried with the option:
Translations ->International
After click in Modify only showed:
Solved it. 2 errors found:
1. The module: Is Featured products
2. The word: is "Featured products" ("products" in lower case).
<h1 class="main-title">
{l s='Featured products' d='Modules.Featuredproducts.Shop'}
</h1p

Prestashop 1.6. How to check if product isPack in .tpl?

I want to check in theme (front) product.tpl file (PS 1.6.1.4) if state if product is Standard product or Pack of existing products
{if $product_type == Product::PTYPE_PACK} not working....
I want to return boolean.
use:
{if $packItems|#count > 0}
an example of using you can find it in product.tpl in the theme folder.
used in this way:
{if $packItems|#count > 0}
<div class="short_description_pack">
<h3>{l s='Pack content'}</h3>
{foreach from=$packItems item=packItem}
<div class="pack_content">
{$packItem.pack_quantity} x {$packItem.name|escape:'html':'UTF-8'}
<p>{$packItem.description_short}</p>
</div>
{/foreach}
</div>
{/if}
in addition, there is in a products object:
$product->id_pack_product_attribute = null
$product->cache_is_pack = 0
for non-pack products

Magento - get categories and subcategories in a collection

I have the following category structure in my magento store
- root
- category 0 (ID 26)
- category 1 (main)
- category A (sub)
- category V (sub)
- category 2 (main)
- category G (sub)
- category J (sub)
- category E (sub)
- category 3 (main)
- category L (sub)
and so on...
On a page i want to be able to output the following:
1. get each (main) category and its name and url
2. get the first (sub) category in (main) and its icon (custom attribute)
So it would output this for each:
<img src="main-cat-first-sub-icon">
main-cat-name
Giving something like:
<category 1 link><category A icon img></link>
<category 1 link><category 1 name>
<category 2 link><category G icon img>
<category 2 link><category 2 link>
<category 3 link><category L icon img>
<category 3 link><category 3 link>
What is the best way of doing so? So far I have:
<?php
$_id = 26 // category 0
$_main_categories = Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('parent_id', array('eq'=>$_id))
->addAttributeToFilter('is_active', 1)
->addAttributeToSelect(array('id','name','url'))
foreach($_main_categories as $_main_cat)
{
// load full main category
$_category = Mage::getModel('catalog/category')->load($_main_cat->getId());
// get sub category's children
$_main_cat_subs = $_category->getChildrenCategories();
// loop through sub catagories, get icon in first and break
foreach($_main_cat_subs as $_sub_cat)
{
// load full sub category
$_sub = Mage::getModel('catalog/category')->load($_sub_cat->getId());
$i++;
$_icon = $_sub_cat->getIcon();
}
if( $i >= 1 ){
break; // as i only want the first one
}
}
// output
?>
<a href="<?php echo $_main_cat->getUrl() ?>">
<img src="<?php echo $_icon ?>">
</a>
<a href="<?php echo $_main_cat->getUrl() ?>">
<?php echo $_main_cat->getName() ?>
</a>
<?php
}
?>
This works but seems very bad practice to load the full category models in a foreach loop twice and when the site grows could take a long time.
What is the best way of doing the above performance wise?
What you could optimize is this:
$_category = Mage::getModel('catalog/category')->load($_main_cat->getId());
Here you are loading the category (again) from the database. Though you already loaded a collection, you should put all the categories you need in that collection with the right attributes.
Then instead of the code above, use this handful collection function to get the category entity:
$_category = $_main_categories->getItemById($_main_cat->getId());
//...
$_sub = $_main_categories->getItemById($_sub_cat->getId());
You should see a clear improvement in the performance, especially if you have a lot of categories.

Configurable Product turn Out of Stock when all child product are out of stock

Hey guys i got a little dilema. I am running Magento ver. 1.7.0.2
When you create a configurable product you must set the stock "in stock" and then you add the other additional products with different stock.
When the additional products stock goes to 0 the main configurable product still is "in stock".
I want that when all the additional products stock goes to 0 then the main configurable product stock to turn into "out of stock".
I am using this custom code for "out of stock" products to appear always at the bottom page. And unless the configurable product dont receive the option "out of stock" it cant go to bottom page.
$this->getSelect()->joinLeft(array('_inventory_table'=>$this->getTable('cataloginventory/stock_item')),"_inventory_table.product_id = e.entity_id",array('is_in_stock', 'manage_stock'));
$this->addExpressionAttributeToSelect('on_top','(CASE WHEN (((_inventory_table.use_config_manage_stock = 1) AND (_inventory_table.is_in_stock = 1)) OR ((_inventory_table.use_config_manage_stock = 0) AND (1 - _inventory_table.manage_stock + _inventory_table.is_in_stock >= 1))) THEN 1 ELSE 0 END)',array());
$this->getSelect()->order('on_top DESC');
Have you made sure you have the correct Magento settings?
Inventory "Show Out Of Stock" = "No"
Configurable product Manage Stock = "No"
Simple product /Manage Stock = "Yes"
I don't know if this would work for you but I think you can solve this from the template itself on the file "app/base/default/template/catalog/product/view.phtml", the line of code that says:
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<? else : ?>
enter code here
<?php endif ?>
if you base it from the original file in the base template you may see this code starting from line 100 as you can see if all the options of the configurable product is empty it means that all products are already sold out causing it not to display the form fields necessary for adding it to the cart.
I hope this helps. :)
Add this code
$this->getSelect()->joinLeft(
array('_inventory_table'=>$this->getTable('cataloginventory/stock_item')),
"_inventory_table.product_id = e.entity_id",
array('is_in_stock', 'manage_stock')
);
$this->addExpressionAttributeToSelect('on_top',
'(CASE WHEN (((_inventory_table.use_config_manage_stock = 1) AND (_inventory_table.is_in_stock = 1)) OR ((_inventory_table.use_config_manage_stock = 0) AND (1 - _inventory_table.manage_stock + _inventory_table.is_in_stock >= 1))) THEN 1 ELSE 0 END)',
array());
$this->getSelect()->order('on_top DESC');
before line:
if ($attribute == 'price' && $storeId != 0) {
in files:
app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php
or in app/code/core/Mage/Catalog/Model/Product/Collection.php if you have Magento 1.7.0.0 +

How to echo the number of reviews of the product on the product page in Magento?

I am unable to echo the number of my products reviews on one of my tabs.
Now the title of my reviews tab is Product’s Reviews and I would like to change it to Reviews(0)
I need to have a number of reviews in the brackets.
How to echo the nuber of reviews from this product?
FYI this is NOT working for me:
<?php echo $this->__(\'%d Review(s)\', $this->getReviewsCount()) ?>
Try the following code ( the code taken from Inchoo.com site ) :
// Get product review info (independent) of review page
<?php
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel('review/review_summary')
->setStoreId($storeId)
->load($_product->getId());
/* #var $summaryData Mage_Review_Model_Review_Summary */
/*
array(
['primary_id'] => 147
['entity_pk_value'] => 166
['entity_type'] => 1
['reviews_count'] => 1
['rating_summary'] => 80
['store_id'] => 1
)
*/
?>
and Echo this as <?php echo $summaryData['reviews_count']; ?>
$reviewsCount = Mage::getModel('review/review')
->getTotalReviews($product_id, true, Mage::app()->getStore()->getId());
i followed the code from Mage_Rating_Block_Entity_Detailed
as the second argument is set true in getTotalReviews so it will only get count of approved reviews.
i have found that the review summary count and ratings are taken from the code ...
$product=166;//demo product id
$storeId=Mage::app()->getStore()->getId();
$product=Mage::getModel('catalog/product')->load($product_id);
$product_review=Mage::getModel('review/review_summary')
->setStoreId($storeId)
->load($product_id);
echo $val->getReviewsCount();
echo $val->getRatingSummary();
Please try very simple code It's work for me.
<?php echo $this->getReviewsSummaryHtml($_product, 'short')?>
It's look like attached screenshot.

Resources