Menu
  • HOME
  • TAGS

Hide a paragraph of static block /cms page from wholesale customer group in magento

magento,magento-1.8,static-block

If,you want to hide a text paragraph from ,then first check wholesaler is logged in or not, then check current customer group is wholesaler. Here code add in header.phtml <?php if(Mage::getSingleton('customer/session')->isLoggedIn() and Mage::getSingleton('customer/session')->getCustomerGroupId()==2 ){ ?> <script type="text/javascript"> document.getElementById("noforid").style.display=none; </script> /* using jquery*/ <?php // do not show paragraph //Get customer...

Magento Reindex error on “Category Products”

magento,magento-1.8,magmi

Just import this sql to reset the categories it helps me (v 1.7) http://pastebin.com/iCSH64zb if 1.8 has another tables structure, just make a new installation of magento with your version to the new db and export of the following tables: catalog_category_entity catalog_category_entity_datetime catalog_category_entity_decimal catalog_category_entity_int catalog_category_entity_text catalog_category_entity_varchar and import it to...

how to find menu ul tag position in magento

html,magento-1.8

There are many option to do this, what i recommend you have to login in your magento dashboard then go to System->configuration->then select developer from left panel. Then you will find there one debug tag click on there then select yes to template path hints. Then Save your setting. Now...

how to add a custom column to sales order grid in magento to show custom product attribute

php,magento,magento-1.8

Step 1 :- Copy app\code\core\Mage\Adminhtml\Block\Sales\Order\grid.php to app\code\local\Mage\Adminhtml\Block\Sales\Order\grid.php Find protected function _prepareColumns() To Add column use this code:- $this->addColumn('color ', array( 'header' => Mage::helper('sales')->__('color #'), 'index' => 'color', 'sortable' => false, 'filter' => false, 'renderer' => 'Mage_Adminhtml_Block_Sales_Order_Renderer_Productatt', )); Step 2:- Create a new file at :-...

Magento - Set product visibility on observer at store level before product save

php,magento,magento-1.8

Finally got it. The observer function: public function before_product_save($observer) { $product = $observer->getProduct(); $product->setStoreId(1)->setData('visibility', 4); } where, the store id is 1 and the visibility attribute value 4 refers to Catalog, Search....

$this->getRequest()->getParam() not working in category controller

magento,magento-1.7,magento-1.8

In your query string ?manufacturer=4 will give you the value for manufacturer i.e. 4, while manufacturer/4 will give you no value as its not being treated as query string. Also the param will be and the param will be manufacturer/4 and not manufacturer. To achieve what you require, you can...

Magento Extension/Theme Packaging

magento,magento-1.7,magento-1.8,magento-1.6

This is the only way to package extension to use base/default or default/default location for template, layout and skin folders. Because if custom theme is used, then also this will work due to Magento's fallback mechanism. And if user want to add those files in custom theme location, then he/she...

Display prices for registered users only in Magento

magento,magento-1.8

If you use standard methods to display prices you can do this with observers. Define observers in your module config.xml <catalog_product_collection_load_after> <observers> <hide_price_list_collection> <type>singleton</type> <class>your_module/observer</class> <method>listCollection</method> </hide_price_list_collection> </observers> </catalog_product_collection_load_after> <catalog_product_load_after> <observers> <hide_price_product>...

Magento 1.8. How to add one customer in two or more groups?

magento,magento-1.7,magento-1.8

First of by default magento does not provide this type functionality. If you want do that you can do using this hack method Note that it is not standard method to achieve this and i am not sure how it behaves when shopping cart rules apply First of all go...

In Magento how to get the regular price of each product that include tax in the shopping cart?

magento,magento-1.8

Something like this? Mage::helper('tax')->getPrice($_item->getProduct(), $_item->getProduct()->getPrice()); See also Magento get price including tax in a none-template file...

Magento - have custom 'Footer Links' static block on all Checkout pages

magento,frameworks,e-commerce,magento-1.8

One way to do it would be via the local.xml in /app/design/frontend/yourpackagename/yourthemename/layout/local.xml. The handles that you need to add depend on how your checkout process is configured. Here is some example code to get you started: <checkout_cart_index> <remove name="footer"> </checkout_cart_index> <checkout_onepage_index> <remove name="footer"> </checkout_onepage_index> This is removing the entire footer...

Magento - always show free shipping even before postcode/zip entered

php,magento,e-commerce,magento-1.8

You could remove the standard Magento shipping quote altogether and have a drop down menu so that customers could see all (one) of the shipping options straight away on the basket page. I downloaded and installed this extension and it worked well. http://excellencemagentoblog.com/magento-shipping-method-dropdown-default-shipping-method-on-cart-page Make sure your default country is United...

Get custom phtml content using observer on core_block_abstract_to_html_after event

php,magento,magento-1.7,magento-1.8

Creating a block is fairly easy when you get the layout (it is just a matter of calling createBlock() with the block type you want and setTemplate() with the template you want to use). And you can always get the layout from another block. So in your case : $observer->getEvent()...

Returning values in Magento

magento,magento-1.8

if your ajax request is sent successfully then add this code in you controller action. $response['prodcutdata'] = $products1; $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response)); return; After that in ajax request success access it like below: alert(response.prodcutdata); ...

Add new configurable field of datetime type via system.xml

magento,magento-1.8,magento-1.9

etc/system.xml: <date translate="label"> <label>Date</label> <frontend_type>text</frontend_type> <frontend_model>your_module/date</frontend_model> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </date> Block/Date.php <?php class Your_Module_Block_Date extends Mage_Adminhtml_Block_System_Config_Form_Field { protected function...

magento - bilingual store - limit display of category tabs (menus)

category,magento-1.8

Answer was right there in Category Setup Page! In Category Setup Page, in Upper left hand corner, select store that you don't want to show category, specify "Is Active" = No Unwanted tab is now gone. Repeat for each category as required....

Find products with duplicate attribute value

mysql,database,duplicates,magento-1.8,products

I have resolved this issue by applying another query to filter out the results. this may not be a good solution but it helped me out. after getting results from above query, I used a foreach loop to find if the attribute value is unique or not. foreach($QueryCollection as $data){...

Cart Rules base on QTY in magento

magento,shopping-cart,magento-1.8,shipping

You want to sell 6 bottles to be one package? So the quantity is 1 not 6? Am I right? There is no cart rule that can handle it. In catalog price rule you can only sum quantity or weight. By quantity it is meant "standard quantity" that is visible...

Calling testimonial module in magento using code

magento,magento-1.8

Module init code should be turnkeye_testimonial/testimonial instead of turnkeye/testimonial if you want field by individual item then you can do this by primary key of testimonial table . $collection $model = Mage::getModel('turnkeye_testimonial/testimonial')>load(id); if you want to fetch multiple items then you need Resource Collection Mage::getResourceModel('turnkeye_testimonial/testimonial')->addFieldToSelect('*'); or $collection = Mage::getModel('turnkeye_testimonial/testimonial')->getCollection(); for...

Magento, I changed product attribute configuration, now my products are not storing new value of it

php,magento,magento-1.8

Thanks guys for your suggestions, Magento uses EAV, my attribute was text type when i created it but later on, we changed it to decimal so the products which are previously created getting values from catalog_product_entity_text table and storing new value at catalog_product_entity_decimal table, i don't know why it happened....

Path in Magento gets wrong when uploaded to webbserver

php,magento,magento-1.8

This because Apache rewrite failed. You have to upload .htaccess (get original from magento package or upload one from your localhost) file in your hosting, in magento root directory.

Magento site css not load after editing web/unsecure/base_url in core_config_data in mysql database

mysql,css,magento,magento-1.8

If your site was located in foo.com/foo/ and you changed it to foo.com then there are two possible reasons; One, your site with corresponding styles is located in a sub directory /foo/ and therefore altering the entry to foo.com won't load any styles unless your style sheets erc have been...

Magento - displaying a random testimonial

magento-1.8

$collection=Mage::getModel('turnkeye_testimonial/testimonial')->getCollection(); $collection->getSelect()->order('rand()'); $collection->setPage(1, $numProducts); foreach($collection as $testimonial) { /My Div } ...

PHP “echo” Magento Fancybox

php,magento,fancybox,fancybox-2,magento-1.8

Use the code below <?php echo $_product->getYoutube(); ?> ...

Magento Fatal error: Call to a member function addData()

php,magento,magento-1.8,mage,adminhtml

Look at line 48 of app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php. There you should see $wizardBlock = $this->getLayout()->createBlock('adminhtml/system_convert_gui_edit_tab_wizard'); You should check if you have that file app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php. If you have the file above, verify what's $this->getLayout() by using the methods is_object and get_class. Also check for any modules from app/code/local or app/code/community that override the...

ad thumbnail to aw blog posts in magento

php,html,magento-1.8,phtml

In your blog.phtml subst <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$post->getFeaturedImage() ?>" alt="featuredImage" /> with <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).DS.'blogpic'.DS.$post->getFeaturedImage() ?>" alt="featuredImage" /> Hope it helps....

Magento redirect to homepage after changing base url to www?

.htaccess,magento,url-rewriting,magento-1.8

It can issue for htaccess. Step1:find htacess RewriteEngine on the added below for Redirecting non-www to www url RewriteCond %{HTTP_HOST} !^www\.mensstore\.biz RewriteRule (.*) http://www.mensstore.biz/$1 [R=301,L] OR RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Step 2:Goto your database and then go to core_config_data there search SELECT * FROM `core_config_data` WHERE `path`...

Magento - template displays correctly once Layouts in Cache Storage is Disabled

magento,caching,frameworks,themes,magento-1.8

File this one under Works as Designed, although your question is a little unclear. Using stateful information within a cached block or the template of a cached block will lead to one state being added to the cache, and your conditional won't run again until the cache expires the entry....

Can I load all shipping methods automatically on the shopping cart page without selecting a country first?

php,magento,magento-1.8

Check Programatically retrieve list of all shipping methods http://www.pixlpitch.com/how-to-get-all-active-shipping-methods/ http://www.magentocommerce.com/boards/viewthread/280208/...

Add exactly 1 product to cart programmatically in Magento

php,magento,magento-1.8

Axel makes a very good point, but to answer your immediate question, why not test for the product's presence before you add it $cartHelper = Mage::helper('checkout/cart'); $items = $cartHelper->getCart()->getItems(); $subtotal = $totals["subtotal"]->getValue(); $free_samples_prod_id = 1285; if ( $subtotal >= 50 ) { $alreadyAdded = false; foreach ($items as $item) {...

Magento 1.8 to 1.9 custom module

magento,module,magento-1.8

Has no difference, which can be is the theme, checks if it is the same theme in both, and if are the same pages of template and layout, that you are adding or editing. After update the cache and the index and test....

Where to find the select html tag for countries on the checkout page in Magento 1.8

magento,magento-1.8

For add new class in select ...you need to flow below steps: Step:copy app\code\core\Mage\Checkout\Block\Onepage\Abstract.php to app\code\local\Mage\Checkout\Block\Onepage\Abstract.php Here you have find the function getCountryHtmlSelect($type) COde $select = $this->getLayout()->createBlock('core/html_select') ->setName($type.'[country_id]') ->setId($type.':country_id') ->setTitle(Mage::helper('checkout')->__('Country')) ->setClass('validate-select') ->setValue($countryId) Change to and i have added a new class...

Cart items is not showing on my custom script page

magento,magento-1.7,magento-1.8

You can use below script it's working fine <?php define('MAGENTO_ROOT', getcwd()); $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; require_once $mageFilename; Mage::init(); // for custom script $coreSession = Mage::getSingleton('core/session', array('name' => 'frontend')); /// Obtain the frontend session for custom script $cart = Mage::getModel('checkout/cart')->getQuote(); foreach ($cart->getAllItems() as $item) { echo $productName = $item->getProduct()->getName(); echo...

How to save an option title and values for a specific store view?

magento,magento-1.8

For an example you can try below: //Create options array $values = array( //15 is the option_id of the option in 'eav_attribute_option_value' table 15 => array( 0 => 'Apple' //0 is current store id, Apple is the new label for the option ), 19 => array( 0 => 'Nexus' ),...

Magento trigger shipping by custom option

magento,magento-1.8

One way to do this is to overwrite the isVirtual() function within: app/code/core/Mage/Downloadable/Model/Product/Type.php When the custom option is selected (and only then), it should behave like: public function isVirtual($product = null) { return false; } Checkout will then act like with normal products and request for shipping options....

out of stock's notification mail is not working

php,magento,magento-1.8,magento-1.9,magento-1.9.1

Add these headers and pass it: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = "[email protected]"; $subject = "Product in demand"; $txt = "Hello Admin.'<br />Customer'.".$pincode."wants to be notified when the below product is available in our inventory<br /><p>Item Name :".$name."</p><p>SKU :".$sku."</p><p> Search Code...

Change subtotal with given price & quantity (custom attribute)

magento,overwrite,magento-1.8,subtotal

Rather than overriding sub-total calculation function, I suggest to try events - sales_quote_save_after and sales_order_save_after. You can get quote and sales in observer method by $observer->getEvent()->getOrder() //for order $observer->getEvent()->getQuote() //for quote Then modify the subtotal accordingly. Edit: It might be just hint how can you modify sub total. Edit2: You...

Magento Admin “Send Email” button not working

magento,email,magento-1.8

Just been looking into this myself. I've followed the code and functions back to this function "public function sendNewOrderEmail()" in: app/code/core/Mage/Sales/Model/Order.php starting at line 1270 is the following code: $emailSentAttributeValue = $this->load($this->getId())->getData('email_sent'); $this->setEmailSent((bool)$emailSentAttributeValue); if ($this->getEmailSent()) { return $this; } This is checking the sales_flat_order db table to see if the...

Update custom product attribute values - Magento

magento,magento-1.8

I assume that $my_data is an array of product ids that need to be updated. If so, try this. It is much faster: $db_data = array('custom_product_option'=>3); Mage::getSingleton('catalog/product_action')->updateAttributes( $my_data, //array with ids to be updated, $db_data, //array with attributes to be updated, 0 //store id for the update : 0 =...

Lost Pagination Toolbar in Magento 1.8.1

magento,magento-1.8

Following things you can try in order to Cope-up with this situation : 1) Disable those modules which is overriding Catalog module and check once again. 2) Check whether Toolbar block is calling or not using Template and Block Path hints using Magento Admin. 3) If you are using any...

In Magento,how can i add different image for same product that was assigned to more than one category,When it is in different categories

magento,magento-1.8

Ok fair enough. Here's a quick solution to your problem. It's a bit scrappy, but you get the idea. In this example I assume your ladies category has an ID of 123, and the image you want to show in the ladies category is the product's second image; $otherImage =...

Magento get child categories / category collection handling. Programming efficiency

php,performance,magento,magento-1.8

if you have a look at the code getStoreCategories calls a little down the line it uses Mage_Catalog_Model_Resource_Category_Tree. Perhaps you can use it yourself like this: <?php require_once('app/Mage.php'); Mage::app(); $parent = Mage::app()->getStore()->getRootCategoryId(); $recursionLevel = 2; $tree = Mage::getResourceModel('catalog/category_tree'); /* @var $tree Mage_Catalog_Model_Resource_Category_Tree */ $nodes = $tree->loadNode($parent) ->loadChildren($recursionLevel) ->getChildren();...

Restrict access to magento admin based on user agent?

php,.htaccess,magento,magento-1.8

Use MobileDetect.php (http://mobiledetect.net/). It's a simple class to use. require_once 'Mobile_Detect.php'; $detect = new Mobile_Detect; // Any mobile device (phones or tablets). if ( $detect->isMobile() ) { echo "Mobile"; } // Any tablet device. if( $detect->isTablet() ){ echo "Tablet"; } Edit 1: Added .htaccess redirect. RewriteEngine On # Check for...

Magento display products list outside magento

php,magento,magento-1.8

The error appears because you are creating an instance of the Mage_Catalog_Block_Product_List class using new. You should use the createBlock method because some other stuff happens in there. Also I don't think you need to create an instance of Mage_Catalog_Block_Product_List_Toolbar block. This should happen automatically (on the same line where...

Adding mini-login to header of page

magento,magento-1.8

goto customer.xml(path app/design/frontend/your package/your template/layout) add below tag under <default></default> default tag <default> .... <reference name="header"> <block type="customer/form_login" name="header_customer_form_mini_login" template="customer/form/mini.login.phtml"/> </reference> ... </default> Under call this file under header.phtml using this code <?php echo $this->getChildHtml('header_customer_form_mini_login');?>...

Variable 'innodb_lock_wait_timeout' is a read only variable

php,mysql,magento-1.8

innodb_lock_wait_timeout can be set at runtime with the SET GLOBAL or SET SESSION statement. Changing the GLOBAL setting requires the SUPER privilege and affects the operation of all clients that subsequently connect. Any client can change the SESSION setting for innodb_lock_wait_timeout, which affects only that client. You may also change...

Perform Some Action after Customer successful Login : Magento

magento,magento-1.8,magento-1.9

You need to use customer_login On the Mage_Customer_Model_Session model's method setCustomerAsLoggedIn() the event customer_login is dispatched. config.xml <customer_login> <observers> <yourobservername> <type>model</type> <class>yourmodule/path_to_class</class> <method>customerLogin</method> </yourobservername> </observers> </customer_login> and your Observer class YourCompany_YourModule_Model_Observer { public function customerLogin($observer) { $customer =...

404 on magento configuration

magento,magento-1.8

I found the solution. The section name should be same as tabs. I have used the tab name as netbank and section name as banking. I have now changed banking to netbank. Its working fine now. Thankyou guys....

Magento Wholesale store URL issue

magento,magento-1.8

please tak a look under admin > configuration > Web ( take a look under url options , secure url , unsecrure url ) or check in database table under database core_config_data this can solve your problem Thanks...

How to send custom attribute in magento Order email.

php,mysql,magento,zend-framework,magento-1.8

Is this message saved on your database? If so, there's a simple way you can do this. Creating a custom variable for the email can be too much time consuming, so the easiest way to get this result would be using a .phtml file on your transactional email. Add this...

Uncaught exception: Mage_Core_Model_Store_Exception

magento,magento-1.8

I added the following line after require_once 'app/Mage.php'; require_once 'app/Mage.php'; Mage::app('main'); where 'main' is my store's code. I have only one store in Magento. I found this solution in another file I'm using which contains require_once 'app/Mage.php' but doesn't give an error. I don't know why it worked, but it...

Magento module for exporting order info

php,magento,magento-1.8

you can get data in observer like below function public function orderExportTxt(Varien_Event_Observer $observer) { $order = $observer->getEvent()->getOrder(); print_r($order->getData()); // your user detail. } EDIT To get Product detail from order <?php $order_id = 2314; //use your own order id $order = Mage::getModel("sales/order")->load($order_id); //load order by order id $ordered_items = $order->getAllItems();...

How to add quantity option to each product item in the category list page?

magento,magento-1.8

try this code instead of Add To Cart button <form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> <?php if(!$_product->isGrouped()): ?> <label for="qty"><?php echo $this->__('Qty') ?>:</label> <input type="text" class="input-text qty" name="qty" id="qty" maxlength="12" value="<?php echo...

How to pass a result in phtml file from controller Magento?

php,magento,magento-1.8

you can use magento registry for setting and getting values as: set a value (in controller) Mage::register('var_name',$var_value); get a value (in phtml/view) $var_value = Mage::registry('var_name'); more you can find at http://alanstorm.com/magento_registry_singleton_tutorial http://stackoverflow.com/a/18157176/725306...

Magento setShippingMethod('freeshipping_freeshipping') observer event

magento,magento-1.7,magento-1.8,magento-1.9

There no events is exits name of add_to_cart_before. You can use other event like: checkout_cart_save_before checkout_cart_add_product_complete etc ...

How to use DotNetOpenAuth.OAuth.DesktopConsumer.RequestUserAuthorization with url contaqins port?

magento,url,port,dotnetopenauth,magento-1.8

I found solution not in DotNetOpanAuth but in magento. By default magento ignores port when calculating the signature in Mage_Oauth_Model_Server::_validateSignature(). To change it you must pass the false parameter to the $this->_request->getHttpHost(). May be it will be possible Magento Rest Oauth API (Signature Invalid) 401

Magento Permission - I can't add anything via Magento Backend

php,magento,error-handling,permissions,magento-1.8

Try to use full path to this folders and set permissions to subfiles/subfolders too: sudo chmod -R 775 /full/path/to/magento/app/etc sudo chmod -R 775 /full/path/to/magento/var if it still return 'No such file or directory', just create it before: sudo mkdir /full/path/to/magento/app/etc sudo mkdir /full/path/to/magento/var If this don't help - contact your...

Install magento theme manually from .zip

magento,themes,magento-1.8

The "theme" actually looks like it's a theme and a module. (I'm assuming the ... is a stand in for a huge list of files. Your theme's folder structure mirrors a Magento folder structure. If you look at your Magento system you'll see it has a app/code/... app/design/frontend While the...

How to save an attribute value for a specific store view?

magento,magento-1.8

After you have created the product it should have an id. Here is a fast way to update the product name and short description for a specific store view without calling the resource consuming save method. Let's assume that the product id is 10 and the store view id is...

Send order email from admin not working in Magento 1.8

magento,magento-1.8

Just been looking into this myself. I've followed the code and functions back to this function "public function sendNewOrderEmail()" in: app/code/core/Mage/Sales/Model/Order.php starting at line 1270 is the following code: $emailSentAttributeValue = $this->load($this->getId())->getData('email_sent'); $this->setEmailSent((bool)$emailSentAttributeValue); if ($this->getEmailSent()) { return $this; } This is checking the sales_flat_order db table to see if the...

How to hide payment method on shopping cart price rules?

magento,magento-1.7,magento-1.6,magento-1.8

Go into the app/design/frontend/base/default/template/checkout/onepage/payment/methods.php change your methods.php to this code <?php $methods = $this->getMethods(); $oneMethod = count($methods) <= 1; ?> <?php if (empty($methods)): ?> <dt> <?php echo $this->__('No Payment Methods') ?> </dt> <?php else: $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); $grandtotal = round($totals["grand_total"]->getValue()); foreach ($methods as $_method): $_code =...

Magento Sort categories by product count

php,magento,magento-1.8

Try below code once. Change your category ID. <?php $cats = Mage::getModel('catalog/category')->load(3)->getChildrenCategories(); ?> <ul> <?php $resourcearray = array(); foreach($cats as $category): $proCnt = $category->getProductCount(); $proName = $category->getName(); $proUrl = $category->getUrl(); array_push($resourcearray, array('count' => $proCnt, 'name' => $proName,'url' => $proUrl)); ?> <?php endforeach; ksort($resourcearray); ?> <?php foreach($resourcearray as $val): ?> <li>...