Magento Product Selection in WordPress ACF Field

September 29, 2016 § Leave a comment

ACF Magento Product Select Field

Base on ACF Field Type Template

Setup

Install Magento WordPress integration, make sure it works first.
Put this into wp-content/plugins folder
Activate this plugin. (Make some products in your magento site).

Heads up

Only support ACF v.5 at the moment.

You could find the github repos here https://github.com/nickwanhere/acf-field-magento-product

or wordpress directory https://wordpress.org/plugins/mage-product-select-for-acf/

Advertisements

Magento: How to enable Magento translation API when using it out of Magento?

November 29, 2012 § Leave a comment

Simple as it can be.

Mage::app->getTranslator()->init('frontend');

Magento 1.7.0.1 , How to make Optional Zip Code works again in checkout!

November 16, 2012 § Leave a comment

Edit the checkout.xml in the layout folder.
Within the tag, add following code which supposed to be there…

        <reference name="head">
            <block type="core/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" />
        </reference>

Using WordPress code outside of WordPress Finally

October 30, 2012 § Leave a comment

I believe you came across with this http://codex.wordpress.org/Integrating_WordPress_with_Your_Website, simply not working at all :[.

After messing around, I found couple recipes.

In every page, put this on top.

/* Short and sweet */
define('WP_USE_THEMES', false);
global $domain, $path, $base, $admin_page_hooks, $ajax_results, $all_links, $allowedposttags, $allowedtags, $authordata, $bgcolor, $cache_categories, $cache_lastcommentmodified, $cache_lastpostdate, $cache_lastpostmodified, $cache_userdata, $category_cache, $class, $comment, $comment_cache, $comment_count_cache, $commentdata, $current_user, $day, $debug, $descriptions, $error, $feeds, $id, $is_apache, $is_IIS, $is_macIE, $is_winIE, $l10n, $locale, $link, $m, $map, $max_num_pages, $menu, $mode, $month, $month_abbrev, $monthnum, $more, $multipage, $names, $newday, $numpages, $page, $page_cache, $paged, $pagenow, $pages, $parent_file, $preview, $previousday, $previousweekday, $plugin_page, $post, $post_cache, $post_default_category, $post_default_title, $post_meta_cache, $postc, $postdata, $posts, $posts_per_page, $previousday, $request, $result, $richedit, $single, $submenu, $table_prefix, $targets, $timedifference, $timestart, $timeend, $updated_timestamp, $urls, $user_ID, $user_email, $user_identity, $user_level, $user_login, $user_pass_md5, $user_url, $weekday, $weekday_abbrev, $weekday_initial, $withcomments, $wp, $wp_broken_themes, $wp_db_version, $wp_did_header, $wp_did_template_redirect, $wp_file_description, $wp_filter, $wp_importers, $wp_plugins, $wp_taxonomies, $wp_the_query, $wp_themes, $wp_object_cache, $wp_query, $wp_queries, $wp_rewrite, $wp_roles, $wp_similiesreplace, $wp_smiliessearch, $wp_version, $wpcommentspopupfile, $wpcommentsjavascript, $wpdb [IF YOU NEED TO ADD MORE];

require('blog/wp-blog-header.php');

Of course you will still get some error, search that part of the code and look for what global variable the function is calling, and put it in the end of the declaration. Such as $acf in my case.

Good to go!

PHP Zip Snippet

February 22, 2012 § Leave a comment

<?php
system("zip -r /PATH/archive.zip /FOLDER_PATH");
?>

Magento: How to Get Quote when Admin Manually Creating Order

October 17, 2011 § 1 Comment

In the frontend store, we normally use

Mage::getModel('core/session')->getQuote();

But in the admin panel, if you ever want to access the quote that is created by admin you can use

Mage::getSingleton('adminhtml/session_quote')

Magento Deadly Loop

October 16, 2011 § 6 Comments

In Magento, you may see this

Fatal error: Allowedmemory size of 33554432 bytes exhausted (tried to allocate 363 bytes) in....

So it means that you are in a loop, or not enough memory to run the magento.

In my case, I was customizing Magento in a great extend , such as product price calculation and shopping process. Everything is going fine when the currency stays the same, but if you switch currency you will get into a dead loop.

When touching price calculation , you always come across Quote Item Abstract class. However, I oversaw the fact that the class already get the method to get the quote, which I instead use

Mage::getModel('core/session')->getQuote();

So it ends up looping over and over again, taking me using log function to track where it is.

Question is therefore¬†raised, why would the Mage::getModel(‘core/session’)->getQuote() will only looping when switching currency? Need to investigate.