As an example: <image:caption>A & E - It' fails with the &
The data in the table is obviously fine because it's used elsewhere. What about the thumbnail caption that's causing it to fail? Anyone else have this issue? Workarounds?
find:
Code: Select all
$output .= '<image:caption>' . $product['name'] . '</image:caption>';
Code: Select all
$output .= '<image:caption>' . str_replace('&', '&', html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8')) . '</image:caption>';
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
I think allowing ™ and ® are reasonable characters to expect in a product name. and there are just so many possible characters to anticipate. Somethings' just not setup to handle them correctly.IP_CAM wrote:™ is probably NOT allowed even in HTML because it's likely 'interpreted' as BEEING some (invalid) HTML Code !
Ernie
Straightlight, you've been very helpful with this error but I've tried to fix hundreds of variants and I'm still getting errors on the sitemap with no finish line in sight.
For now I'm just going to submit my own sitemap and forget about the hack. Well, unless something better comes along.
Thanks for you help.
BTW, is this something that's still broken in version 2.2?
In catalog/controller/feed/google_sitemap.php flle,
find:
Code: Select all
protected function getCategories($parent_id, $current_path = '') {
Code: Select all
protected function sanitizeXML($xml_content, $xml_followdepth = true) {
if (preg_match_all('%<((\w+)\s?.*?)>(.+?)</\2>%si', $xml_content, $xmlElements, PREG_SET_ORDER)) { $xmlSafeContent = '';
foreach ($xmlElements as $xmlElem){
$xmlSafeContent .= '<'.$xmlElem['1'].'>';
if (preg_match('%<((\w+)\s?.*?)>(.+?)</\2>%si', $xmlElem['3'])) {
$xmlSafeContent .= $this->sanitizeXML($xmlElem['3'], false);
} else {
$xmlSafeContent .= htmlspecialchars($xmlElem['3'], ENT_NOQUOTES);
}
$xmlSafeContent .= '</'.$xmlElem['2'].'>';
}
if (!$xml_followdepth) {
return $xmlSafeContent;
} else {
return "<?xml version='1.0' encoding='UTF-8'?>".$xmlSafeContent;
}
} else {
return htmlspecialchars($xml_content, ENT_NOQUOTES);
}
}
Code: Select all
$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($parse_output);
Code: Select all
$parse_output = $this->sanitizeXML($output);
$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($parse_output);
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Where your search was:
Code: Select all
$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($parse_output);
Code: Select all
$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($output);
This is intended. The $set_output variable is the parsed variable that should be replaced with. Although, I did not tried it with the same $output variable for various reasons, in this case.lfairban wrote:Thanks, I'll try that.
Where your search was:I had the following (output)Code: Select all
$this->response->addHeader('Content-Type: application/xml'); $this->response->setOutput($parse_output);
Code: Select all
$this->response->addHeader('Content-Type: application/xml'); $this->response->setOutput($output);
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Can you clarify: 'Doesn't seem to have done the trick?'lfairban wrote:That doesn't seem to have done the trick.
I wonder if the expression (%<((\w+)\s?.*?)>(.+?)</\2>%si) is catching all of the errors I'm seeing?
I'm not all that good with Reg Exp. what is this expression finding?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
&[#0-9a-z]+;
That regular expression appears to only search for standard html so it's not finding ®, ™ and other special characters in the name of the product.Can you clarify: 'Doesn't seem to have done the trick?'
Code: Select all
%<((\w+)\s?.*?)>(.+?)</\2>%si
Since I'm not putting "html" in the Name field, it's not finding html. I need help build something that would search for special characters. ..Let me try something. I may have answered my own question.
Change:
Code: Select all
$this->response->addHeader('Content-Type: application/xml');
Code: Select all
$this->response->addHeader('Content-Type: text/xml');
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The VQMOD search wasn't selecting as expected.
I changed the file directly and got different results... it's failing on the image caption now.
Code: Select all
</image:loc><image:caption>Coin & Feather
Users browsing this forum: No registered users and 47 guests