REST API + Polylang

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

"... 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 |

OC Bug list

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
+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

OpenCart 3: Sorting product list in invoice

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Most of orders contain 1-2 items, but there could be 10+ and it becomes a problem to follow the invoice and picking items from the shelves. Any field of your choice: model, sku, etc. Here is an example how to update invoice and packing list (vqmod format):

<?xml version="1.0" encoding="utf-8"?>
  <id>For OpenCart</id>
  <author>alex cherednichenko</author>

  <file name="admin/controller/sale/order.php">
    <operation error="skip">
      <search position="before" index="2,3">
        $data['orders'][] = array(
// alcher
        array_multisort(array_map(function($element) {
          return $element['model'];
        }, $product_data), SORT_ASC, $product_data);
// alcher				

Source: 3 solutions for sorting multidimensional arrays by child keys or values in PHP

Streaming string in PHP

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

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);


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. [...]

OpenCart: Maintenance Mode

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Unfortunately, being logged-in as Administrator you can forget, that Maintenance Mode is ON and the website is not accessible for the users until your decide to check it from another computer or device and figure out that you had a problem… for a long time.

Background image will be displayed for both back-end and front-end if you put your site in Maintenance Mode, see the screenshot below:

1001-maintenance-warning Ocmod
1001-maintenance-warning Ocmod
13.5 KiB

OpenCart 3 Improved Customer Search

How many time you could not recognize the name and the problem, but you have had a phone number? In OpenCart, there is no way to find the order by phone number. I had this hard coded, but now it's available as a mod. You will be search the order by name, phone number (only digits) or email [...]