Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Сделать вкладку "Характеристики" главной


Recommended Posts

В итоге сам нашел, как это сделать. Если кому-то интересно:

Открываем файл: catalog/view/theme/YOURTHEME/template/product/product.tpl

Находим код:

<div id="tabs" class="htabs"><a href="#tab-description"><?php echo $tab_description; ?></a>
	<?php if ($attribute_groups) { ?>
	<a href="#tab-attribute"><?php echo $tab_attribute; ?></a>
	<?php } ?>
И меняем местами вторую и первую вкладки. Получаем:

<div id="tabs" class="htabs"><?php if ($attribute_groups) { ?>
    <a href="#tab-attribute"><?php echo $tab_attribute; ?></a>
    <?php } ?>
    <a href="#tab-description"><?php echo $tab_description; ?></a>
  • +1 2
Надіслати
Поділитися на інших сайтах


  • 4 months later...
  • 2 weeks later...

Если у тебя стоит Хак Документация, и при перемене вкладок "Характеристики" и "Описание не отображается вкладка с Докуметацией, открывай vqmod/xml/brunno-product_free_download-base.xml и меняй строчки после которых вставлять строчки VQmod'у.

Короче у меня этот файл выглядит так :

<modification>

<id>Product Free Download</id>

<version>1.0.1</version>

<vqmver>1.0.8</vqmver>

<author>www.brunno.info</author>

<file name="admin/view/template/catalog/product_form.tpl">

<operation>

<search position="replace"><![CDATA[

<div id="tabs" class="htabs"><a href="#tab-general"><?php echo $tab_general; ?></a><a href="#tab-data"><?php echo $tab_data; ?></a><a href="#tab-links"><?php echo $tab_links; ?></a><a href="#tab-attribute"><?php echo $tab_attribute; ?></a><a href="#tab-option"><?php echo $tab_option; ?></a><a href="#tab-discount"><?php echo $tab_discount; ?></a><a href="#tab-special"><?php echo $tab_special; ?></a><a href="#tab-image"><?php echo $tab_image; ?></a><a href="#tab-reward"><?php echo $tab_reward; ?></a><a href="#tab-design"><?php echo $tab_design; ?></a></div>

]]></search>

<add><![CDATA[

<div id="tabs" class="htabs"><a href="#tab-general"><?php echo $tab_general; ?></a><a href="#tab-data"><?php echo $tab_data; ?></a><a href="#tab-links"><?php echo $tab_links; ?></a><a href="#tab-attribute"><?php echo $tab_attribute; ?></a><a href="#tab-option"><?php echo $tab_option; ?></a><a href="#tab-discount"><?php echo $tab_discount; ?></a><a href="#tab-special"><?php echo $tab_special; ?></a><a href="#tab-image"><?php echo $tab_image; ?></a><a href="#tab-reward"><?php echo $tab_reward; ?></a><a href="#tab-design"><?php echo $tab_design; ?></a><a href="#tab-free_download"><?php echo $tab_free_download; ?></a></div>

]]></add>

</operation>

<operation>

<search position="before"><![CDATA[

<div id="tab-general">

]]></search>

<add><![CDATA[<div id="tab-free_download"><table id="downloads" class="list">

<thead>

<tr>

<td class="left" style="width:100px; vertical-align: middle; "><?php echo $text_free_download_icon; ?></td>

<td class="left" style="vertical-align: middle; "><?php echo $text_free_download_name; ?></td>

<td class="center" style="width:30px; vertical-align: middle; "><?php echo $text_free_download_count; ?></td>

<td class="center" style="width:100px; vertical-align: middle; "><?php echo $text_free_download_action; ?></td>

</tr>

</thead>

<?php $download_row = 0; ?>

<?php foreach ($product_free_download as $product_downloads) { ?>

<tbody id="download_row<?php echo $download_row; ?>">

<tr>

<td class="center">

<input type="hidden" name="product_downloads[<?php echo $download_row; ?>][filename]" value="<?php echo $product_downloads['filename']; ?>" id="download<?php echo $download_row; ?>" />

<input type="hidden" name="product_downloads[<?php echo $download_row; ?>][file]" value="<?php echo $product_downloads['file']; ?>" id="download<?php echo $download_row; ?>" />

<input type="hidden" name="product_downloads[<?php echo $download_row; ?>][download]" value="<?php echo $product_downloads['download']; ?>" id="download<?php echo $download_row; ?>" />

<img src="<?php echo $product_downloads['preview']; ?>" alt="" id="preview<?php echo $download_row; ?>" class="image" onclick="download_upload('download<?php echo $download_row; ?>', 'thumbs<?php echo $download_row; ?>');" />

</td>

<td class="left" style="vertical-align: middle; "><?php echo $product_downloads['file'];?></td>

<td class="center" style="vertical-align: middle; "><?php echo $product_downloads['download']; ?></td>

<td class="right"><a onclick="$('#download_row<?php echo $download_row; ?>').remove();" class="button"><span><?php echo $button_remove; ?></span></a></td>

</tr>

</tbody>

<?php $download_row++; ?>

<?php } ?>

<tfoot>

<tr>

<td colspan="4" class="center"><a onclick="addDownload();" class="button"><span><?php echo $button_add_free_download; ?></span></a></td>

</tr>

</tfoot>

</table></div>]]></add>

</operation>

<operation>

<search position="before"><![CDATA[

<script type="text/javascript" src="view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script>

]]></search>

<add><![CDATA[

<script type=text/javascript"><!--

function download_upload(field, thumbs) {

$('#dialog').remove();

$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/downloadmanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');

$('#dialog').dialog({

title: '<?php echo $text_download_manager; ?>',

close: function (event, ui) {

if ($('#' + field).attr('value')) {

$.ajax({

url: 'index.php?route=common/downloadmanager/download&token=<?php echo $token; ?>',

type: 'POST',

data: 'download=' + encodeURIComponent($('#' + field).attr('value')),

dataType: 'text',

success: function(data) {

$('#' + thumbs).replaceWith('<img src="<?php echo HTTP_CATALOG.'download/';?>' + $('#' + field).attr('value') + '" width = "100" height = "100" alt="" id="' + thumbs + '" class="image" onclick="download_upload(\'' + field + '\', \'' + thumbs + '\');" />');

}

});

}

},

bgiframe: false,

width: 700,

height: 400,

resizable: false,

modal: false

});

};

//--></script>

<script type="text/javascript"><!--

var download_row = <?php echo $download_row; ?>;

function addDownload() {

html = '<tbody id="download_row' + download_row + '">';

html += '<tr>';

html += '<td class="center"><input type="hidden" name="product_downloads[' + download_row + ][filename]" value="" id="download' + download_row + '" /><input type="hidden" name="product_downloads[' + download_row + '][file]" value="" id="download' + download_row + '" /><img src="<?php echo $no_image; ?>" alt="" id="preview' + download_row + '" class="image" onclick="download_upload(\'download' + download_row + '\', \'preview' + download_row + '\');" /></td>';

html += '<td class="left"></td>';

html += '<td class="left"></td>';

html += '<td class="center"><a onclick="$(\'#download_row' + download_row + '\').remove();" class="button"><span><?php echo $button_remove; ?></span></a></td>';

html += '</tr>';

html += '</tbody>';

$('#downloads tfoot').before(html);

download_row++;

}

//--></script>

]]></add>

</operation>

</file>

<file name="admin/controller/catalog/product.php">

<operation>

<search position="after" offset="7"><![CDATA[

if (isset($this->request->post['product_download'])) {

]]></search>

<add><![CDATA[

$this->data['tab_free_download'] = $this->language->get('tab_free_download');

$this->data['text_free_download_icon'] = $this->language->get('text_free_download_icon');

$this->data['text_free_download_name'] = $this->language->get('text_free_download_name');

$this->data['text_free_download_count'] = $this->language->get('text_free_download_count');

$this->data['text_free_download_action'] = $this->language->get('text_free_download_action');

$this->data['button_add_free_download'] = $this->language->get('button_add_free_download');

$this->data['text_download_manager'] = $this->language->get('text_download_manager');

$this->model_catalog_product->checkFreeDownloads();

$this->data['product_free_download'] = array();

if (isset($product_info)) {

$results = $this->model_catalog_product->getProductFreeDownloads($this->request->get['product_id']);

foreach ($results as $result) {

if ($result['mask'] && file_exists(DIR_DOWNLOAD .'data/'. $result['filename'])) {

$ext = strtolower(substr($result['mask'],strrpos($result['mask'],'.') + 1));

if ($ext=='zip' || $ext=='rar' || $ext=='pdf' || $ext=='dxf'){

$preview = $this->model_tool_image->resize($ext.'.png', 100, 100);

}

else {

$preview = $this->model_tool_image->thumbs('data'.$result['filename'], 100, 100);

}

$this->data['product_free_download'][] = array(

'preview' => $preview,

'file' => $result['mask'],

'filename' => $result['filename'],

'download' => $result['download']

);

} else {

$this->data['product_free_download'][] = array(

'preview' => $this->model_tool_image->resize('no_image.jpg', 50, 50),

'file' => $result['mask'],

'filename' => $result['filename'],

'download' => $result['download']

);

}

}

}

]]></add>

</operation>

</file>

<file name="admin/model/catalog/product.php">

<operation>

<search position="before" offset="2" index="1"><![CDATA[

$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'product_id= . (int)$product_id . "', keyword = '" . $this->db->escape($data['keyword]) . "'");

]]></search>

<add><![CDATA[

if (isset($data['product_downloads'])) {

foreach ($data['product_downloads'] as $download) {

$filename = substr($this->db->escape($download['filename']),4);

$maskk = substr($this->db->escape($download['filename']),0,strrpos($this->db->escape($download['filename']),'.'));

$mask= substr($maskk,strrpos($maskk,'/')+1);

$download = 0;

$this->db->query("INSERT INTO " . DB_PREFIX . "product_download SET product_id = '" . (int)$product_id . "', filename = '" . $filename . "', mask = '" . $mask . "', download = '" . $download . "'");

}

}

]]></add>

</operation>

<operation>

<search position="before"><![CDATA[

$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id. "'");

]]></search>

<add><![CDATA[

$this->db->query("DELETE FROM " . DB_PREFIX . "product_download WHERE product_id = '" . (int)$product_id . "'");

if (isset($data['product_downloads'])) {

foreach ($data['product_downloads'] as $download) {

if ($download['file']=="") {

$filename = substr($this->db->escape($download['filename']),4);

$maskk = substr($this->db->escape($download['filename']),0,strrpos($this->db->escape($download['filename']),'.'));

$mask= substr($maskk,strrpos($maskk,'/')+1);

$download = 0;

}

else {

$filename = $this->db->escape($download['filename']);

$mask = $this->db->escape($download['file']);

$download = (int)$download['download'];

}

$this->db->query("INSERT INTO " . DB_PREFIX . "product_download SET product_id = '" . (int)$product_id . "', filename = '" . $filename . "', mask = '" . $mask . "', download = '" . $download . "'");

}

}

]]></add>

</operation>

<operation>

<search position="before"><![CDATA[

public function getProductStores($product_id) {

]]></search>

<add><![CDATA[

public function checkFreeDownloads() {

$create_downloads = "CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_download` (

`product_download_id` int(11) NOT NULL auto_increment,

`product_id` int(11) NOT NULL,

`filename` varchar(255) collate utf8_bin default NULL,

`mask` varchar(255) collate utf8_bin NOT NULL,

`download` int(11) NOT NULL,

PRIMARY KEY (`product_download_id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;";

$this->db->query($create_downloads);

}

public function getProductFreeDownloads($product_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_download WHERE product_id = '" . (int)$product_id . "'");

return $query->rows;

}

]]></add>

</operation>

</file>

<file name="admin/model/tool/image.php">

<operation>

<search position="after" offset="2"><![CDATA[

return HTTP_IMAGE . $new_image;

]]></search>

<add><![CDATA[

function thumbs($filename, $width, $height) {

if (!file_exists(DIR_DOWNLOAD . $filename) || !is_file(DIR_DOWNLOAD . $filename) ) {

return;

}

$info = pathinfo(substr($filename,0,-33));

$extension = $info['extension'];

$old_image = $filename;

$new_image = 'cache/' . substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;

if (!file_exists(DIR_DOWNLOAD . $new_image) || (filemtime(DIR_DOWNLOAD . $old_image) > filemtime(DIR_DOWNLOAD . $new_image))) {

$path = '';

$directories = explode('/', dirname(str_replace('../', '', $new_image)));

foreach ($directories as $directory) {

$path = $path . '/' . $directory;

if (!file_exists(DIR_DOWNLOAD . $path)) {

@mkdir(DIR_DOWNLOAD . $path, 0777);

}

}

$image = new Image(DIR_DOWNLOAD . $old_image);

$image->resize($width, $height);

$image->save(DIR_DOWNLOAD . $new_image);

}

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {

return substr(HTTPS_IMAGE,0,-6) . 'download/' . $new_image;

} else {

return substr(HTTPS_IMAGE,0,-6) . 'download/' . $new_image;

}

}

]]></add>

</operation>

</file>

<file name="catalog/controller/product/product.php">

<operation>

<search position="before"><![CDATA[

$this->data['tab_attribute'] = $this->language->get('tab_attribute');

]]></search>

<add><![CDATA[

$this->data['tab_downloads'] = $this->language->get('tab_downloads');

]]></add>

</operation>

<operation>

<search position="before"><![CDATA[

$this->data['button_cart'] = $this->language->get('button_cart');

]]></search>

<add><![CDATA[

$this->data['button_download'] = $this->language->get('button_download');

$this->data['product_free_downloads'] = array();

if (isset($product_info)) {

$results = $this->model_catalog_product->getProductFreeDownloads($this->request->get['product_id']);

foreach ($results as $result) {

if ($result['mask'] && file_exists(DIR_DOWNLOAD .'data/'. $result['filename'])) {

$size = filesize(DIR_DOWNLOAD . 'data/'. $result['filename']);

$i = 0;

$suffix = array(

'B',

'KB',

'MB',

'GB',

'TB',

'PB',

'EB',

'ZB',

'YB'

);

while (($size / 1024) > 1) {

$size = $size / 1024;

$i++;

}

$this->load->model('tool/image');

$ext = strtolower(substr($result['mask'],strrpos($result['mask'],'.') + 1));

if ($ext=='zip' || $ext=='rar' || $ext=='pdf' || $ext=='dxf'){

$preview = $this->model_tool_image->resize($ext.'.png', 50, 50);

}

else {

$preview = $this->model_tool_image->thumbs('data'.$result['filename'], 50, 50);

}

$this->data['product_free_downloads'][] = array(

'file' => $result['mask'],

'thumb' => $preview,

'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i],

'download_id' => $result['product_download_id'],

'href' => HTTPS_SERVER . 'index.php?route=product/download/download&product_download_id=' . $result['product_download_id']

);

}

}

}

]]></add>

</operation>

</file>

<file name="catalog/model/catalog/product.php">

<operation>

<search position="before"><![CDATA[

public function getTotalProductSpecials() {

]]></search>

<add><![CDATA[

public function getProductFreeDownloads($product_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_download WHERE product_id = '" . (int)$product_id . "'");

return $query->rows;

}

]]></add>

</operation>

</file>

<file name="catalog/model/tool/image.php">

<operation>

<search position="before" offset="1"><![CDATA[

?>

]]></search>

<add><![CDATA[

function thumbs($filename, $width, $height) {

if (!file_exists(DIR_DOWNLOAD . $filename) || !is_file(DIR_DOWNLOAD . $filename) ) {

return;

}

$info = pathinfo(substr($filename,0,-33));

$extension = $info['extension'];

$old_image = $filename;

$new_image = 'cache/' . substr($filename, 0, strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;

if (!file_exists(DIR_DOWNLOAD . $new_image) || (filemtime(DIR_DOWNLOAD . $old_image) > filemtime(DIR_DOWNLOAD . $new_image))) {

$path = '';

$directories = explode('/', dirname(str_replace('../', '', $new_image)));

foreach ($directories as $directory) {

$path = $path . '/' . $directory;

if (!file_exists(DIR_DOWNLOAD . $path)) {

@mkdir(DIR_DOWNLOAD . $path, 0777);

}

}

$image = new Image(DIR_DOWNLOAD . $old_image);

$image->resize($width, $height);

$image->save(DIR_DOWNLOAD . $new_image);

}

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {

return substr(HTTPS_IMAGE,0,-6) . 'download/' . $new_image;

} else {

return substr(HTTPS_IMAGE,0,-6) . 'download/' . $new_image;

}

}

]]></add>

</operation>

</file>

<file name="catalog/view/theme/*/template/product/product.tpl">

<operation>

<search position="after"><![CDATA[

<a href="#tab-description"><?php echo $tab_description; ?></a>

]]></search>

<add><![CDATA[

<?php if ($product_free_downloads) { ?><a href="#tab-downloads"><?php echo $tab_downloads; ?></a><?php } ?>

]]></add>

</operation>

<operation>

<search position="after"><![CDATA[

<div id="tab-description" class="tab-content"><?php echo $description; ?></div>

]]></search>

<add><![CDATA[

<?php if ($product_free_downloads) { ?><div id=tab-downloads" class="tab_content">

<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">

<table class="list" style="width:100%;">

<?php foreach ($product_free_downloads as $download) { ?>

<tr>

<td style="text-align: left; width:60px; vertical-align: middle; "><img src="<?php echo $download['thumb]; ?>" title="<?php echo $download['file']; ?>" alt="<?php echo $download['file']; ?>" /></td>

<td style="text-align: left; vertical-align: middle; "><?php echo $download['file']; ?></td>

<td style="text-align: right; vertical-align: middle; "><?php echo $download['size']; ?></td>

<td style="text-align: left; width:100px; vertical-align: middle; "><a onclick="location = '<?php echo $download['href']; ?>'" class="button"><span><?php echo $button_download; ?></span></a></td>

</tr>

<?php } ?>

</table>

</div>

</div><?php } ?>

]]></add>

</operation>

</file>

</modification>

  • +1 1
Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.