Override Engine and OpenCart 3.0.3.6

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

In OpenCart 3.0.3.6 (since 3.0.3.5 ??)  the Twig was moved to another location, and, OverrideEngine stopped working. Unfortunately, there is no any newer version from author.

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

OC 3.0.3.2 Bug list

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
bug-list-3.0.3.2
description
+fedex- template errorA
layout- added sort by layout_idC
paypal standard- replace pp_standard payment moduleC
+sessions_gc.ocmod- clean session tableC
+subtotal- missing orderA
+usps shipping- missing US Mail First ClassC
+ups shipping- missing prefix (shipping_)Cscript

Streaming string in PHP

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

RFC 2397 (Section 3) states that passes data should be either in base64 encoding or urlencoded.

  • First line is a header by default
  • Empty/blank lines are ignored
function read_line( $data, $header = [], $delimiter = "\t", $skipped = 0, $counter = PHP_INT_SIZE ) {

  $fo = new SplFileObject('data://text/plain,' . urlencode($data), 'r');
  $header = empty($header) ? $fo->fgetcsv($delimiter) : $header;

  if( $skipped > 0 ) { $fo->seek ($skipped - 1); }
  
  while ( !$fo->eof() && $counter-- ) {
    $data = $fo->fgetcsv($delimiter);
    if(empty(array_filter($data, "trim"))) continue;
    yield  array_combine($header, $data);
  }  
}

Sources:

OC3 UPS shipping module fix

It seems to get fixed in 3.1+ version but, not in OpenCart 3.0. I've just created file, named mod-fixes.vqmod.xml and placed in /system directory, have been tired to create install for every POS.
Just create a file and copy/paste code or create install.xml and amke a mod. [...]

Yandex.Metrica