Open Cart : store time_zone

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

To Whom … is West of UTC (UTC-XX)

  • Unable to log-in to the admin
  • API (for ex: update order status) calls are not working

All of the above, it will call framework.php

date_default_timezone_set($config->get('date_timezone'));
... 
// Database 
if ($config->get('db_autostart')) { 
// Sync PHP and DB time zones 
  $db->query("SET time_zone = '" . $db->escape(date('P')) . "'"); 
}

with time_zone from /system/config/default.php

// Date
$_['date_timezone'        = 'UTC'
(more…)

OpenCart : PHP 8

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.50 out of 5)
Loading...

Backward Incompatible Changes:

  • It’s very rare, but in some old extensions or packages, the array and string offset access syntax using curly braces could be found.  It’s deprecated in PHP 7.4 The easiest way to check is to run global search/replace: 
    (\$[A-z0-9_]* ?)\{([^}]+)\} with $1[$2]

    be careful, some JavaScript files could be modified too.

  • “The @ operator will no longer silence fatal errors … Error handlers that expect error_reporting to be 0 when @ is used, should be adjusted to use a mask check instead”. Replace in /system/framework.php (lines 19-21):
    if (error_reporting() === 0) {
      return false;
    }
    with
    if (!(error_reporting() & $code)) {
      return false; // Silenced
    }
  • Comment line 7 in Environment.php from Twig
    @trigger_error(sprintf('Using the "Twig_Environment" class is deprecated since Twig version 2.7, use "Twig\Environment" instead.'), E_USER_DEPRECATED);

    otherwise it will bloat the the OpenCart error file

OpenCart 3 : Last Accessed Selected

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

UPDATED: file restored, updated tags, its should work up to 3.0.3.7
Working with the products, customers,  orders, etc. lists it could be a problem to figure out which one you’ve just viewed or edited. For the most of lists (templates: *_list.twig, the item will be highlighted, after returning back by pressing Cancel or Save.

(more…)

Override Engine and OpenCart 3.0.3.6 & 3.0.3.7

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Since OpenCart 3.0.3.6 (3.0.3.5 ??)  the Twig has been moved to another location, and OverrideEngine stopped working. Unfortunately, there is no newer version from the author.

So, find the code (line 792, version for OpenCart 3.0.3.3):

include_once(DIR_SYSTEM . 'library/template/Twig/Autoloader.php');
Twig_Autoloader::register();
$loader = new \Twig_Loader_Filesystem(DIR_TEMPLATE);		
$config = array('autoescape' => false, 'cache'=>false);

and replace with:

$loader = new \Twig\Loader\FilesystemLoader();
$loader->addPath(DIR_TEMPLATE);
$config = array( 'autoescape'  => false, 'cache'	=> false, 'debug' => false, 'auto_reload' => true );

REST API + Polylang

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

“… none of the offered feeds [RSS does – mine] seem to include information on the language of the content….”

“It is because Frédéric, polylang’s author has not set his taxonomy property ‘show_in_rest’ => true …”

“The plugin author is not planning to add this to the free version. The pro version will get something that could provide for this…”

function wpse_modify_taxonomy() {
    // get the arguments of the already-registered taxonomy
    $language_args = get_taxonomy( 'language' ); // returns an object

    // make changes to the args
    // in this example there are three changes
    // again, note that it's an object
    $language_args->show_in_rest = true;

    // re-register the taxonomy
    register_taxonomy( 'language', 'post', (array) $language_args );
}
// hook it up to 11 so that it overrides the original register_taxonomy function
add_action( 'init', 'wpse_modify_taxonomy', 11 );

It could be slow, it could be something else, but it works.

Source: How to know the language of a post through the WordPress REST API | WordPress.org

Yandex.Metrica