Magento: Get Bundled Items name / title by bundled product Id

This post is jut a small snippets that will help you to get all bundle items’ title.

Of course, I’m not sure how useful can it be as is, so if you need optimized version of it, you will need to play with it for a while. I tried to find it on google few days ago and I had no luck, so if anybody has better solution, please comment.

Here we go:

bundle products

Bundled Products, Magento will not recalculate the Price – Bundle.reloadPrice()

Hello, I’m Tofu, nice to see you again.

My client gave me a purchased Magento template and asked me to install and configure a new Magento store for him. The template was very clean and professional. However, there was an weird issue since it did not support the latest Magento version 1.9.

I created serveral bundle products just for testing purpose then I added or subjected items to the cart, the price did not change. I got js errors:

Uncaught ReferenceError: taxCalcMethod is not defined 
Uncaught TypeError: Cannot call method ‘reloadPrice’ of undefined

Finally, I figured out the problem. We will need to copy the following javascript snippets from BASE theme to our activated theme in
/app/design/frontend/default/YOUR_TEMPLATE/template/
/bundle/catalog
/product/view/type/bundle.phtml

bundle-magento-products

Enjoy!

[Tofu And Tomato] Magento 1.7 “Database server does not support InnoDB storage engine message”

I’m trying to re-install a cloned Magento 1.7 website on a local server using AMPPS. InnoDB is set as the default engine but it still shows me the message: Database server does not support InnoDB storage engine.

To sort out this issue:

Go To Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php

Replace:

public function supportEngine()
{
    $variables  = $this->_getConnection()
        ->fetchPairs('SHOW VARIABLES');
    return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
}

With:

public function supportEngine()
{
    $variables  = $this->_getConnection()
        ->fetchPairs('SHOW ENGINES');
    return (isset($variables['InnoDB']) && $variables['InnoDB'] != 'NO');
}

Also see my screenshot:

magento1.7.inodb

[Tofu And Tomato] [Magento Solutions] Fix email not sent

Today, my client at http://www.dubuy.it/ told me that, he had an weird problem with email settings in Magento, he had never receive any sale / order emails after submitting one-page-checkout form.

If the order displays the email as sent and you or your clients are not receiving the email, then the problem is most likely the email settings you have for Magento or the local email server that Magento is using.

I also checked the settings:

  • Admin -> Configuration > Advanced -> System > SMTP Settings and see that you do not have emails disabled.
  • Admin -> Configuration > General > Store Email Addresses and check if you have the email addresses in there correctly. Sometimes email servers would refuse to send email if the senders email is not a proper email address.

However, the settings are correct but emails still were not sent. After digging into the code, I found the issue:

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 email has already been sent to the customer and if so just to return, but this does not send the email and should throw an error. So I would say it is a bug somewhere. To fix it so you can resend order/invoice emails etc..

Copy

app/code/core/Mage/Sales/Model/Order.php

to

app/code/local/Mage/Sales/Model/Order.php

and comment out line 1273

if ($this->getEmailSent()) {
            //return $this;
        }

Works like a charm for me. But literally only this second tested it.

magento-fix-email-not-send

[Tofu And Tomato] How to add CSS classes to Magento top links.

Ever wonder or ever hit your head on the wall what bloody template file controls the site link, footer link in Magento and how to add a class to it? That’s right, it’s thepage/template/links.phtml.

The template file generates ‘first’ and ‘last’ class in li tag, but sometimes we need more styling in each individual link list and we want to add a class either in li or anchor tag without hacking the core file or extend a class in Magento core, how do we do that?

The answer is in the xml file

magento-top-links

LET’S HAVE A LOOK AT MY CODE:Screen Shot 2014-10-18 at 11.38.48 AM

[Solved] How to use language package from locale folder in magento

Magento is a multi-language eCommerce platform, among other things. Meaning it can support multiple languages through its multiple store concept. Each store presents one locale which further breaks down to language. Default Magento installation comes with en_US locale, meaning US variation of English language. Multi-language support is a highly important feature, even essential one, for most of the modern web shops.

Today, I’ve faced an interesting task dealing with magento’s multi language feature (using different language in each store view). In this blog post, I just wanted to note what I’ve done. That’s extreme simple. Let’s go through the following steps:

1- Access to http://www.magentocommerce.com/magento-connect/ and find language package which you want i.e I find French’s package.

2- Install it from magento connect in admin’s backend.

3- From Configuration into backend. pic 1

We choose Scope from Current Configuration Scope area (left above corner) that we want to change language i.e I choice France.

4- Find Locale Options area => Set locale is French (France)

5- Save Config