get direction in opencart

Well many times i get this error  – Notice: Undefined variable: direction

after using code like this


if ($direction == 'rtl') { echo 'أخبار الموقع'; } else { echo 'News'; }

the soultion is go to here in your opencart site:

catalog/controller/common

open page:

footer.php

add this line :

$this->data['direction'] = $this->language->get('direction');

and your are done

Advertisements

display custom filed using do_shortcode in template

today i needed t o display contact form 7 Shortcode into a template

when it was pulled from custom field in the admin panel

so here is the snippets

<?php // echo do_shortcode(‘[contact-form-7 id=”1067″ title=”landing page”]’);?>

<?php
//change “lp_cf7” to the name of your custom field.
$key = ‘lp_cf7’;
//if the field is set within wordpress, continue
if (get_post_meta($post->ID, $key, true)) { ?>
<?php echo do_shortcode(get_post_meta($post->ID, $key, true));?>
<?php }?>