Post by Besti » Sat Sep 12, 2020 4:04 am

You are a wonder! ;D

It is so nice, when there is someone to guide you, when you are trying to learn :-*
I really appreciate your time and effort!!!!!
I will absolutely follow your advice and above all i have to thank you for a very good explanation!
Actually (concerning your example with dots), i don't use the dots in the urls... And i like the idea a lot! Safety first ;)
But i am not sure how this would affect robots, sitemap etc... They have the dots.. As im not a pro, my questions may sound stupid, but both examples block .txt and .xml... So i don't really get it, if we block them, then what about google etc, they wont be able even to read the robots or am i wrong?

P.S. Ok, checked everything to see myself, looks like files are accessible... Interesting.. A bit confused trying to understand how it works...

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Sat Sep 12, 2020 7:20 am

But i am not sure how this would affect robots, sitemap etc... They have the dots.. As im not a pro, my questions may sound stupid, but both examples block .txt and .xml... So i don't really get it, if we block them, then what about google etc, they wont be able even to read the robots or am i wrong?
It will not affect those as requests for anything you do have in your file-system are served by your webserver anyway, only requests which the webserver cannot find are affected as those are treated as seo uls.
This part:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
means only rewrite if the requested resource cannot be found in your file-system.

So all requests for:
domain/index.php?route=..... are fine because index.php exists.
domain/robots.txt is fine because robots.txt exists.
domain/sitemap.xml is fine as that is rewritten to domain/index.php?route=extension/feed/google_sitemap
etc.

only requests like:
/XXXXX/YYYYY are rewritten to /index.php?_route_=XXXXX/YYYYY because there is no file XXXXX/YYYYY in your file-system and treated as seo urls.
but also:
/database.backup
/TP/public/index.php
/wordpress/xmlrpc.php
/admin/db.dat
/wp/site.zip
/include/dialog/select_soft_post.php
/adminer-3.6.4.php
/website.old
/includes/domain.cfg
etc.
and those (and all the other probes for resources you do not have) trigger needless seo url processing otherwise and here in TW we get those from our friens in Mainland China daily at 100+ requests per second.

so using:

Code: Select all

RewriteCond %{REQUEST_URI} !.*\.(env|php|xml|ashx|cfg|dat|ico|cur|txt|mp3|webp|svg|ttf|eot|woff|woff2|gif|jpg|JPG|jpeg|JPEG|png|js|cfg|css|pdf|zip|env|tar|sql|gz|tar|exe|rar|arj|cab|iso|rpm|tbz|tgz|old|bak|backup|dump|db|7z|asp|aspx|exp|html|htm)$
is fine but then you have to list all possible file extensions while using:

Code: Select all

RewriteCond %{REQUEST_URI} !.*\..*$
we cover them all.

The only useless requests left are like:
/testing
/hello/check
i.e. requests for seo urls with keywords you do not have in your seo url table as those you cannot possibly filter at htaccess level.

ps. this has no bearing on safety/security, we are talking about requests for resources you do not have, just preventing unnecessary processing when those are requested while using seo urls.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Sat Sep 12, 2020 5:24 pm

Thank you very much for an explanation! I prefer to understand (at least a bit) what am i doing... lol
I guess i will stick with your idea with the dot! I really like it! Thank you! :)

My error with the product got back... Sorry, for further questions... :)
2020-09-11 22:11:29 - PHP Notice: Undefined index: attribute_id in /home/wittomin/oc/storage/modification/admin/model/catalog/product.php on line 178
2020-09-11 22:28:37 - PHP Warning: Illegal string offset 'attribute_id' in /home/wittomin/oc/storage/modification/admin/model/catalog/product.php on line 178
2020-09-11 22:28:37 - PHP Warning: Illegal string offset 'attribute_id' in /home/wittomin/oc/storage/modification/admin/model/catalog/product.php on line 180
2020-09-11 22:28:37 - PHP Warning: Illegal string offset 'product_attribute_description' in /home/wittomin/oc/storage/modification/admin/model/catalog/product.php on line 182
2020-09-11 22:28:37 - PHP Warning: Invalid argument supplied for foreach() in /home/wittomin/oc/storage/modification/admin/model/catalog/product.php on line 182
These are the lines - 176-187.. I am a bit lost. Compared with the file, which comes with OC.. looks the same.. No idea why it is complaining... And above all couple of attributes in products disapear from time to time.. Is there a typo or else? It started after modifications with the language, and the attribute disappears only for one language, so it is really strange and looks related to the chenges in language.php or smth... Could be be so kind to take a look...

if (!empty($data['product_attribute'])) {
foreach ($data['product_attribute'] as $product_attribute) {
if ($product_attribute['attribute_id']) {
// Removes duplicates
$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");

foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");
}
}
}
}

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Sat Sep 12, 2020 5:51 pm

well, it is basically complaining about the data it is receiving straight from your view in the post variables when saving a product.

what I would do is put this:

Code: Select all

$this->log->write(print_r($data['product_attribute'],true));
before this:

Code: Select all

foreach ($data['product_attribute'] as $product_attribute) {
then edit a product again and check your oc error log, it should print out the entire product_attribute record structure with the data.
something like:

Code: Select all

2020-09-12 18:03:29 - Array
(
    [0] => Array
        (
            [name] => Fragile
            [attribute_id] => 16
            [product_attribute_description] => Array
                (
                    [2] => Array
                        (
                            [text] => 不
                        )

                    [1] => Array
                        (
                            [text] => No
                        )

                )

        )

)

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Sat Sep 12, 2020 6:49 pm

Thank you for your quick reply!
Did as you have written.. Edited three products even.. Checked all error logs.. Nothing... Just as usual complaining about - cache.catalog.language.1599904579): No such file or directory...

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Sat Sep 12, 2020 9:09 pm

well, that unlink catalog.language is just trying to delete the language definition cache but cannot find the file.
Normally that cache is written in catalog/model/localisation/language.php.

Hard to believe that function getLanguages still has a well reported bug in 3.0.3.6 after all this time.
This:

Code: Select all

$language_data = $this->cache->get('language');
should be this:

Code: Select all

$language_data = $this->cache->get('catalog.language');
That bug is not serious, it just means it writes the catalog.language file every time as it is trying to read file language and cannot find it as it is never written.

Not sure why it cannot delete the catalog.language cache file though.

That cache just holds your language definitions for 3600 seconds so it does not need to query the database every time in between (well, without that bug).
Useless in and off itself of course as it only holds a few records.
After 3600 seconds (the cache time limit) it is refreshed (deleted and rewritten) and also when you change your language definitions in admin.

OC does the same for your currency definitions and some other stuff, just saving the data from the database in a cache file.

Still, this code:

Code: Select all

$this->log->write(print_r($data['product_attribute'],true));
should always write to your OC error log when you save a product which has attributes defined, are you sure you edited the right file from the modification directory?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Sat Sep 12, 2020 9:21 pm

Wow.. Thank you fo the fix for that language bug.. I read it is nothing serious, but it gets annoying every time manually adding the file to cache to delete it.. lol
Hope the fix will work, ill definetely check it in the evening! ;D

I will recheck the code for product.php again.. But this error with attributes is pretty strange - it appears from time to time only in two-three products, one language different attribute for each product, but always the same one.
So product 1 always gets Product type in german deleted, Produt 3 gets always gets for material in german some additional meaningless symbols in it and Product 3 gets quality for german language missing. So always my default language is affected. But is does not happen every time i edit the product.. As i had to edit them pretty often these days, but it happened like couple of times... Starting from 9th...

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Sat Sep 12, 2020 10:03 pm

that is strange, sounds like a data issue to me but not sure.
when you add the $this->log->write...... statement, make sure it is in the editProduct function, the function addProduct (in the same file) also has that code so perhaps you added it there.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Mon Sep 14, 2020 3:11 am

Hello!

Thank you once again! Finally, no language error anymore! :)

Tried to edit product.php again, no success... However the text that appeart in one of the attributes of one of my products is this -

-----WebKitFormBoundaryn8uYYdULNa2qa2aL
Content-Disposition: form-data; name="product_attribute[1][product_attribute_description][1][text]"

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Mon Sep 14, 2020 10:48 am

first check your product_attribute table to see if there is any strange data in the text field.
If not, I would guess that one of the extensions/modifications you installed on the admin side has an issue.
Do you edit your atrribute descriptions manually or using some feed?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Mon Sep 14, 2020 4:40 pm

Good morning!

Maybe there is some data loss in the database or else? I ran a test from Cpanel thought - it says everything ok...
The only extension for admin is to change quantity and price directly from admin - Product Update - ZapsCart ZapsCart Technologies... I will try to turn it off for a while then and see if it solves the problem. But basically the issue started after a backup and when i updated the en route. After a backup everything was upside down as well... And recently the attribute disappeared again, but in the error log - nothing...

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Mon Sep 14, 2020 5:35 pm

Maybe there is some data loss in the database or else? I ran a test from Cpanel thought - it says everything ok...
No I don't mean something wrong with your database tables, I mean some strange text in your text field of the product_attribute table.
like this:

Code: Select all

-----WebKitFormBoundaryn8uYYdULNa2qa2aL
Content-Disposition: form-data; name="product_attribute[1][product_attribute_description][1][text]"

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Mon Sep 14, 2020 7:43 pm

Hello!

No idea if it is all related - the problems with the attribute, the 500 error when i try to export the dtabase through admin and now, which is the worse is 500 error on checkout...
Bank transfer - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
https://wittom.in/index.php?route=exten ... er/confirm

Gosh, i though it is finally working now this.. The Bank transfer was working before. May this be related to our last modifications?

Added: Got this from my hosting provider..
[14-Sep-2020 11:29:39 UTC] PHP Fatal error: Uncaught Exception: Error: Password not accepted from server! in public_html/system/library/mail/smtp.php:205
Stack trace:
#0 public_html/system/library/mail.php(142): Mail\Smtp->send()
#1 public_html/catalog/controller/mail/order.php(275): Mail->send()
#2 public_html/catalog/controller/mail/order.php(34): ControllerMailOrder->add(Array, '1', 'Bank Transfer I...', true)
#3 oc/storage/modification/system/engine/action.php(79): ControllerMailOrder->index('checkout/order/...', Array)
#4 public_html/system/engine/event.php(62): Action->execute(Object(Registry), Array)
#5 oc/storage/modification/system/engine/loader.php(229): Event->trigger('model/checkout/...', Array)
#6 public_html/system/engine/proxy.php(47): Loader->{closure}(Array, Array)
#7 public_html/catalog/controller/extension/payment/bank_transfer.php(23): Proxy->__call('addOrderHistory', Array)
#8 public_html/system/library/mail/smtp.php on line 205

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by letxobnav » Mon Sep 14, 2020 8:24 pm

all 500 errors are logged so there must be a log about your export.
the 500 when checkout is like it says: your smtp password is incorrect when trying to authenticate with your mail server to send the order confirmation email.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Besti » Mon Sep 14, 2020 11:53 pm

Hello!
Evidently all the mess was because of the email missing in the files somehow... After the backup from my provider..
My hosting provider finally managed to fix it.. Even if at first they sent me off.. ???
After the email got fixed, the export of database from admin is possible, checkout with bank transfer works again, so i need just to check whether the attribute error comes back!

Anyway, i would like to thank you for your patience and once again for very valuable advices with a wonderful understandable explanations!!!! :-* ;D

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by ADD Creative » Tue Sep 15, 2020 12:34 am

Besti wrote:
Fri Sep 11, 2020 4:50 pm
The Samesite cookies i have found in forum only for OC2 (my OC 3.0.3.6, php 7.3) - https://forum.opencart.com/viewtopic.p ... 20#p796020. On github they wanted to update OC for this, but i suppose the Samesite was not still implemented for 3.0.3.6..
Used tips for currency, language.. But could not find setcookie in session.php,so tried adding line to htaccess.. Now, no idea if it works and is it enough for PayPal..
It would be advisable to only set SameSite=None if your payment module requires it, otherwise you lose the benefit the extra protection. It's might be best to check first.

None of the PayPal modules in 3.0.3.6 require SameSite=None as far as I aware. The only one with an issue was PayPal Standard. This was fixed in 3.0.3.6 the correct way without the need to set SameSite=None.
https://github.com/opencart/opencart/pull/8072

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Besti » Tue Sep 15, 2020 5:37 am

Not sure what is better...

What i have read:
"Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use.
Specify SameSite=Strict or SameSite=Lax if the cookie should not be sent in cross-site requests
So before redirecting to paypal change the cookie SameSite to None, which override default behavior and you are able save the user session from logging out"

As far as i understand for PayPal Commerce platform, etc will be anyway better to have none and secure or? If i enable Chrome cookies, etc tgrough flags, PayPal buttons dont work. Commerce Platform, not PP Standard.. So the issue exists, i suppose if a buyer cant pay on my website using PayPal with Cookies NOT set to none and secure then it should be fixed.

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by ADD Creative » Tue Sep 15, 2020 7:05 am

If you can only get the PayPal Commerce to work with SameSite=None then that is what you must use.

I'm sure PayPal Commerce worked with the new defaut of Lax when I last tested, Strict did cause problems. Perhaps something has changed since then.

If you are having to set flags to test then remember you need to switch both "SameSite by default cookies" and "Cookies without SameSite must be secure" to Enabled.
chrome://flags/#same-site-by-default-cookies
chrome://flags/#cookies-without-same-site-must-be-secure

For Firefox goto about:config and set "network.cookie.sameSite.laxByDefault" and "network.cookie.sameSite.noneRequiresSecure" to true.

You can check your browser is in the correct mode here. https://samesite-sandbox.glitch.me/

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Besti » Tue Sep 15, 2020 3:29 pm

Good morning!

Well, i tutned them both on, when i was checking.. And the one to see errors as well..
But now, you made me doubt, because i checked it, when my language and currency cookies were set to none secure and only the session cookie was not...
Dont know if it is important..

New member

Posts

Joined
Sun May 24, 2020 4:27 pm

Post by Besti » Tue Sep 15, 2020 3:32 pm

Getting back to the topic...
With the two languages, the sitemap i basically did online and enlarge it slowly manually.. But what about the Google base.. Should i turn the other language as default for a while, to make the xml for google feed in two languages (one will be the one he can fetch and the other static xml)?

Or there is a more decent way to do it? 😇

New member

Posts

Joined
Sun May 24, 2020 4:27 pm
Who is online

Users browsing this forum: No registered users and 5 guests