- Сообщения
- 2 089
- Реакции
- 145
Здравствуйте господа !
Как расшифровать .xml file ?
собственно интересуют эти строки
весь код -
Как расшифровать .xml file ?
собственно интересуют эти строки
Код:
<operation>
<search><![CDATA[if ((float)$product_info['special']) {]]></search>
<add position="before"><![CDATA[
$query = $this->db->query("SELECT d.filename, d.mask, d.download_id FROM " . DB_PREFIX . "download d LEFT JOIN " . DB_PREFIX . "product_to_download p2d ON (p2d.product_id = '" . $product_info['product_id'] . "') WHERE d.download_id = p2d.download_id");
if ($product_info['price'] == 0 && !empty($query->row)) {
$data['download'] = 1;
$data['text_download'] = 'Download';
} else {
$data['download'] = 0;
}
]]></add>
</operation>
весь код -
Код:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Download Button</name>
<version>3.0</version>
<code>download_button</code>
<author>xxvirusxx</author>
<link>https://www.free-time-info.com/en/</link>
<file path="catalog/controller/product/product.php">
<operation>
<search><![CDATA[if ((float)$product_info['special']) {]]></search>
<add position="before"><![CDATA[
$query = $this->db->query("SELECT d.filename, d.mask, d.download_id FROM " . DB_PREFIX . "download d LEFT JOIN " . DB_PREFIX . "product_to_download p2d ON (p2d.product_id = '" . $product_info['product_id'] . "') WHERE d.download_id = p2d.download_id");
if ($product_info['price'] == 0 && !empty($query->row)) {
$data['download'] = 1;
$data['text_download'] = 'Download';
} else {
$data['download'] = 0;
}
]]></add>
</operation>
</file>
<file path="catalog/view/theme/default/template/product/product.twig">
<operation>
<search><![CDATA[<button type="button" id="button-cart" data-loading-text="{{ text_loading }}" class="btn btn-primary btn-lg btn-block">{{ button_cart }}</button>]]></search>
<add position="replace"><![CDATA[
{% if download == 1 %}
<button type="button" id="download-button" data-loading-text="{{ text_loading }}" class="fa fa-cloud-download btn btn-primary btn-lg btn-block">{{ text_download }}</button>
{% else %}
<button type="button" id="button-cart" data-loading-text="{{ text_loading }}" class="btn btn-primary btn-lg btn-block">{{ button_cart }}</button>
{% endif %}
]]></add>
</operation>
<operation>
<search><![CDATA[{{ footer }}]]></search>
<add position="before"><![CDATA[
<script type="text/javascript">
$('#download-button').on('click', function() {
$url = 'index.php?route=product/download&product_id={{ product_id }}';
$.ajax({
url: $url,
type: 'get',
success: function(data) {
if(data == true){
alert('This file is not available for download.');
}else{
window.location =""+$url+"";
}
}
});
});
</script>
]]></add>
</operation>
</file>
</modification>