Editing static blocks problem when saving

I have 1.9.0.3 Magento website, everything was fine, website wasnt edited in a year and when I tried to edit some existing static block and save or save and continue editing I am returned in CMS/Static Blocks panel and no changes are made. It allows me to create new static block, but when I copy paste code from existing old block same happened. What I noticed when playing with blocks when I copy/paste code from existing block in new block for example:

 <div id="banner-slider-demo-2-new" class="owl-carousel owl-theme owl-middle-narrow owl-banner-carousel">     <div class="item" style="background:url({{media url="wysiwyg/porto/homepage/slider/02/13_new.jpg"}})  

Cant save the new created block. When I remove word “style” everything is ok and block is saved. It happen with all lines with “style”. Code is not proper without “style” but block is saved. I flushed everything, deleted cache, same happened. In system.log I found error that repeats 20 times per day in last 12 months:

2019-05-20T16:27:25+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /home/fedorsoaps/public_html/app/code/local/Smartwave/Socialfeeds/Helper/Data.php on line 79

And, line 79 in Data.php is:

 79    foreach ($  doc->getElementsByTagName('ul')->item(0)->childNodes as $  child) {         $  raw = $  doc->saveXML($  child);         $  li = preg_replace("/<li[^>]+\>/i", "", $  raw);         $  peopleList[$  i] = preg_replace("/<\/li>/i", "", $  li);         $  i++; 

Meanwhile website frontend is working normally but I cant make any changes. I am not coder, just basic Magento installer, thanks for any help.

How do you configure a dynamic block for a customer segment in M2C?

Using Magento Commerce (nee EE) 2.3.1, how do you configure a Dynamic Block to render for a specific customer segment?

The stock Magento documentation:

https://docs.magento.com/m2/ee/user_guide/cms/dynamic-blocks.html

does not give you much to work with if it’s not working.

I have a Customer Segment set up for any customer that has placed an order (which has 1 customer record – using the sample data). I have a Cart Rule for 20% off, I want to show a Dynamic Block to that customer segment to promote the Cart Rule.

I have the Dynamic Block set up, and dropped into a CMS page: enter image description here

screenshots

but when I log in as the customer in the customer segment, no promo Dynamic Block appears on the CMS page.

I’ve reindexed and cleared the cache.

Document root change help

I am using Magento 2.3.1 Open Source. I installed it from the .zip file in the public_html folder (I didn’t know any better at the time) in my account at my web host, running on Apache.

I did the Magento Security Scan on my website, and it showed the following problem-

Your Web server is configured to run Magento from %MAGENTO_ROOT% directory. It is recommended to set %MAGENTO_ROOT%/pub as a Web server root directory.

In response I found my way to this page https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html, which had instructions to fix the problem, but they seem to only apply to installations that are not on shared web hosting plans.

I tried to find the files that contain the document root url through SSH-ing into the shared server just in case, but since I don’t have root access it didn’t show.

I contacted my hosting provider twice to change the document root for me through /var/cpanel/userdata/username/example.com, but since there is a language barrier, they told me that that was beyond their expertise, or something like that.

My site is run under https, of course, if that helps any.

I am not too security savvy with Magento, so what I want to know is, if I use the .htaccess commands below to change the document root, would they alone make my Magento installation in public_html secure?-

RewriteEngine on RewriteBase /  RewriteCond %{REQUEST_URI} !^/pub/  RewriteCond %{HTTP_HOST} ^(www\.)?example\.  RewriteRule ^(.*)$   /pub/$  1 [L] 

Do I need to move/copy any Magento files from public_html to public_html/pub if I use the .htaccess commmands above, if so, which files?

If I leave the Magento files in public_html and use the rewrite commands, will that be a security problem?

Do I need to change any settings in the Magento Admin after using the rewrite commands?

Thank you very much.

Magento 2 Assign customer group name to externally calling JavaScript file variable

PreRequisites:

  • MageVersion – Magento 2.3.x
  • External JavaScript – http://domain.com/external-js.js

    var mage_customer_group = ”; //other code related to the customer group

  • Pages – Category page and Custom product listing page (External JavaScript manages the product listing using simple AJAX)

Getting Customer group name by overriding customer section updates and saving into the mage-cache-storage (localstorage).

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching/private-content.html

Customer Data Management in Magento 2

In external-js.js file, 3rd party vendor having logic to send prices and other information based on customer group name. For now, product name, image, link and product price is showing proper. Issue only occures, when category or custom product listing page loads value of mage_customer_group is getting blank value.

While looking on the Network console, first External JavaScript (http://domain.com/external-js.js) calling then customer section update is calling.

Is there any way in KnockOut js that we can bind customer properties to external JS?

Magento 2 OAuth without a Callback URL

I need to integrate a back end application (i.e. without a GUI) with Magento 2 REST APIs. As such I believe I need to use OAuth for authentication. However, as it is a back end service, there will be no users to process any redirects to third party urls. Is it possible to authenticate via OAuth in Magento2 without going to a callback URL? I note when you register an integration the callbacks are optional, and if you leave them blank the access token and access token secret are generated. Many thanks.

catalog:images:resize command stops at 100/2115 images with Error sending QUERY packet

I just migrated an inventory from one Ecommerce Platform to Magento and while running the image:resize command to re-scale the images for them to display, the command consistently fails when it reaches 100 images, this is 100/2115.

Error Message:

Warning: Error while sending QUERY packet. PID=11883 in /home/[server]/public_html/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228  

Does anyone know if there is a work around for this or solution?

PWA Store Deployment on server – Development

I would like to know how to deploy PWA store (With magento pwa-studio) on staging or any other server without passing the PORT number ?

I am working on currently PWA demo instance (Latest Magento version 2.3.1) – as PWA apps running with port number only – URl like – local.pwa.local:2823 (So URL with Port number)

What i want is to run PWA application on my server without port number,directly with the domain name Like – https://mypwa.com

As of now what i have tried as an prerequisite is as below :

  • SSL is already enabled on server
  • PWA is running with PORT Number on server
  • Able to set my custom URL with Port number on server
  • Using nginx reverse proxy i have redirected port number with 443 and store is loading with only domain as well – but issue here is assets are not loading and it gives error.
  • It giving CORS policy error as well.

Can anybody have achieve the same ? is there any standard practice that we need to follow to deploy the pwa-studio ?

Looking forward to here your thoughts/suggestions on the same.