How to handle multi array json data ?

I recently faced issue in handling Multi array Json in for loop. After long R&d I found the following solution

 

eg:

 

jQuery.ajax({
url:’/http://xxxx/xxxxxxxx’,
type: ‘GET’,
cache: false,
data: {“path”:path,”dataa”:dataa},
async: false,
success: function(result) {

console.log(result);

var json_obj = $.parseJSON(result);
var cntTitle = json_obj.cntTitle;
var catlength = json_obj.category;
var i, category, j, col2, k;
for (i = 0; i < json_obj.category.length; i++)
{
category = json_obj.category[i];

$(‘#categoryName’).text(category.catname);

for (j = 0; j < json_obj.category[i].col2.length; j++)
{
col2 = json_obj.category[i].col2[j];
var aaa = $(“#skutitle”).text(col2.skuTitle);
}
}

}
});

Advertisements

How to enable template paths in magento admin panel without extension?

Hi All,

 

To enable template paths in magento admin panel without any extension. Please follow the following process.

Go to your Database and Just run this query:

INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'dev/debug/template_hints', 1),
('default', 0, 'dev/debug/template_hints_blocks', 1);

To disable them again, run this query:

UPDATE core_config_data set value = 0 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'

To enable again run this query:

UPDATE core_config_data set value = 1 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'

php files are not loading on server ?

Dear All,

In few cases php files wont be loaded on server, but when the same files extensions are changes to .html., it will work, In this case login to cpanel -> find php configuration -> select option php 5.x (single php.ini) and create a php.ini file in your public_html folder and set engine = on in configuration. It will work.

 

Notice- Need to remove other php.ini in sub directories

How to make woocommerce registration approval by admin using wp approve users?

Dear All,

Wp Approve users plugin lets admin to hold registration for approval. However it will not let to integrate with woocommerce. To make this happen., Please use the following code in your themes functions.php file:

 

function woocommerce_registration_autologout(){
       if ( is_user_logged_in() ) {
                $current_user = wp_get_current_user();
                $user_id = $current_user->ID;
                $approved_status = get_user_meta($user_id, 'wp-approve-user', true);
                //if the user hasn't been approved yet by WP Approve User plugin, destroy the cookie to kill the session and log them out
        if ( $approved_status == 1 ){
            return $redirect_url;
        }
                else{
            wp_logout();
                        return get_permalink(woocommerce_get_page_id('myaccount')) . "?approved=false";
                }
        }
}
add_action('woocommerce_registration_redirect', 'woocommerce_registration_autologout', 2);
function registration_message(){
        $not_approved_message = '<p class="registration">Send in your registration application today!<br /> NOTE: Your account will be held for moderation and you will be unable to login until it is approved.</p>';
        if( isset($_REQUEST['approved']) ){
                $approved = $_REQUEST['approved'];
                if ($approved == 'false'echo '<p class="registration successful">Registration successful! You will be notified upon approval of your account.</p>';
                else echo $not_approved_message;
        }
        else echo $not_approved_message;
}
add_action('woocommerce_before_customer_login_form', 'registration_message', 2);

How to make html5 calendar date picker to appear on firefox and IE ?

Hi All,

 

HTML 5 date picker wont work on firefox and IE on giving <input type=”date”>.It works only with chrome browser. Inorder to make datepicker to appear on those browsers simply add the following code in your page.

<script src=”//code.jquery.com/jquery-1.11.0.min.js”></script>
<script src=”//cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js”></script>
<script>
webshims.setOptions(‘forms-ext’, {types: ‘date’});
webshims.polyfill(‘forms forms-ext’);
</script>
<script language=”javascript”>
function getCity()
{
document.getElementById(“txtCity1”).value=document.getElementById(“txtCity”).value;
}
</script>