Fórum OpenCart Brasil

Por um e-commerce livre, confiável e profissional

#13291
Peguei este mod em Vqmod, no qual permite alterar preço, descricao, e outros dados na lista de produtos.

Precisa do VqMod 2.15
Código: Selecionar todos
<modification>
	<id>Edit Prices from Product List Page</id>
	<version>1.6</version>
	<vqmver>2.1.5</vqmver>
	<author>jadedstudio,edited by hamburlger,Melon</author>
	<file name="admin/view/template/catalog/product_form.tpl">
			<operation>
					<search position="after" offset="2"><![CDATA[<td><input type="text" name="price" value="<?php echo $price; ?>" /></td>]]></search>
					<add><![CDATA[<tr>
		  <td><?php echo $entry_cost; ?></td>
		  <td><input type="text" name="cost" value="<?php echo $cost; ?>" /></td>
		</tr>]]></add>
			</operation>
	</file>
	<file name="admin/controller/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[$this->data['entry_price'] = $this->language->get('entry_price');]]></search>
			<add><![CDATA[$this->data['entry_cost'] = $this->language->get('entry_cost');]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[if (isset($this->request->post['price'])) {]]></search>
			<add><![CDATA[
			if (isset($this->request->post['cost'])) {
				$this->data['cost'] = $this->request->post['cost'];
			} else if (!empty($product_info)) {
				$this->data['cost'] = $product_info['cost'];
			} else {
				$this->data['cost'] = '';
			}
			]]></add>
		</operation>
        <operation error="skip">
            <search position="before"><![CDATA[
  	private function getList() {
            ]]></search>
            <add trim="true"><![CDATA[
	public function simple_pu() {
    	$this->load->language('catalog/product');

    	$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('catalog/product');

		if (isset($this->request->post['selected']) && $this->validateSimplePu()) {
			$url = '';

			$this->session->data['success'] = $this->language->get('text_success');

			if (isset($this->request->get['filter_name'])) {
				$url .= '&filter_name=' . $this->request->get['filter_name'];
			}

			if (isset($this->request->get['filter_model'])) {
				$url .= '&filter_model=' . $this->request->get['filter_model'];
			}

			if (isset($this->request->get['filter_price'])) {
				$url .= '&filter_price=' . $this->request->get['filter_price'];
			}

			if (isset($this->request->get['filter_quantity'])) {
				$url .= '&filter_quantity=' . $this->request->get['filter_quantity'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}
			foreach ($this->request->post['selected'] as $product_id) {
			
			$price_str = $product_id.'_price';
			$quantity_str = $product_id.'_quantity';
			$model_str = $product_id.'_model';
			$name_str = $product_id.'_name';
			$status_str = $product_id.'_status';
			
			$price = $this->request->post[$price_str];
			$quantity = $this->request->post[$quantity_str];
			$model = $this->request->post[$model_str];
			$name = $this->request->post[$name_str];
			$status = $this->request->post[$status_str];
			
			$su_data = array('price' => $price, 'quantity' => $quantity, 'model' => $model, 'name' => $name, 'status' => $status);
			$this->model_catalog_product->editPrices($product_id, $su_data);
	  		}

			$this->redirect($this->url->link('catalog/product', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}
    	$this->getList();
  	}
            ]]></add>
        </operation>
		<operation error="skip">
            <search position="after"><![CDATA[
		$this->data['delete'] = $this->url->link('catalog/product/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
            ]]></search>
            <add trim="true"><![CDATA[
		$this->data['simple_pu'] = $this->url->link('catalog/product/simple_pu', 'token=' . $this->session->data['token'] . $url, 'SSL');
            ]]></add>
        </operation>
		<operation error="skip">
            <search position="after"><![CDATA[
		$this->data['button_delete'] = $this->language->get('button_delete');
            ]]></search>
            <add trim="true"><![CDATA[
		$this->data['button_simple_pu'] = $this->language->get('button_simple_pu');
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="before"><![CDATA[
  	private function validateCopy() {
            ]]></search>
            <add trim="true"><![CDATA[
private function validateSimplePu() {
    	if (!$this->user->hasPermission('modify', 'catalog/product')) {
      		$this->error['warning'] = $this->language->get('error_permission');
    	}

		if (!$this->error) {
	  		return TRUE;
		} else {
	  		return FALSE;
		}
  	}
		    ]]></add>
        </operation>
	</file>
	
	<file name="admin/model/catalog/product.php">
        <operation error="skip">
            <search position="before"><![CDATA[
	public function editProduct($product_id, $data) {
            ]]></search>
            <add trim="true"><![CDATA[
    public function editPrices($product_id, $su_data) {
		if (isset($su_data['price']) && isset($su_data['quantity']) && isset($su_data['model']) && isset($su_data['status'])) {
			$this->db->query("UPDATE " . DB_PREFIX . "product SET price = '" . (float)$su_data['price'] . "', quantity = '" . (int)$su_data['quantity'] . "', model = '" . $this->db->escape($su_data['model']) . "', status = '" . (int)$su_data['status'] . "' WHERE product_id = '" . (int)$product_id . "'");
		}
		if (isset($su_data['name'])) {
			$this->db->query("UPDATE " . DB_PREFIX . "product_description SET name = '" . $this->db->escape($su_data['name']) . "' WHERE product_id = '" . (int)$product_id . "'");
		}
	}
		    ]]></add>
        </operation>
		<operation>
			<search position="replace"><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', destaque = '" . (int)$data['destaque']."', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");]]></search>
			<add><![CDATA[$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', cost = '" . (float)$data['cost'] . "', destaque = '" . (int)$data['destaque']."', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', destaque = '". (int)$data['destaque']."', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");]]></search>
			<add><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', destaque = '". (int)$data['destaque']."', price = '" . (float)$data['price'] . "', cost = '" . (float)$data['cost'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");]]></add>
		</operation>
	</file>
	
	<file name="admin/view/template/catalog/product_list.tpl">
        <operation error="skip">
            <search position="replace"><![CDATA[
    <div class="buttons"><a onclick="location = '<?php echo $insert; ?>'" class="button"><?php echo $button_insert; ?></a><a onclick="$('#form').attr('action', '<?php echo $copy; ?>'); $('#form').submit();" class="button"><?php echo $button_copy; ?></a><a onclick="$('form').submit();" class="button"><?php echo $button_delete; ?></a></div>
            ]]></search>
            <add trim="true"><![CDATA[
    <div class="buttons"><a onclick="location = '<?php echo $insert; ?>'" class="button"><?php echo $button_insert; ?></a><a onclick="$('#form').attr('action', '<?php echo $simple_pu; ?>'); $('#form').submit();" class="button"><?php echo $button_simple_pu; ?></a><a onclick="$('#form').attr('action', '<?php echo $copy; ?>'); $('#form').submit();" class="button"><?php echo $button_copy; ?></a><a onclick="$('form').submit();" class="button"><?php echo $button_delete; ?></a></div>
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
              <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" checked="checked" />
			  ]]></search>
            <add trim="true"><![CDATA[
              <input type="checkbox" name="selected[]" id="<?php echo $product['product_id']; ?>_select" value="<?php echo $product['product_id']; ?>" checked="checked" />
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
              <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" />
			  ]]></search>
            <add trim="true"><![CDATA[
              <input type="checkbox" name="selected[]" id="<?php echo $product['product_id']; ?>_select" value="<?php echo $product['product_id']; ?>" />
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
			  <?php echo $product['price']; ?>
			]]></search>
            <add trim="true"><![CDATA[
			  <input type="text" class="<?php echo strtolower($column_price); ?> editable" name="<?php echo $product['product_id']; ?>_price" id="<?php echo $product['product_id']; ?>_price" value="<?php echo $product['price']; ?>" size="8" onclick='document.getElementById("<?php echo $product['product_id']; ?>_select").setAttribute("checked","checked");' />
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
			  <?php echo $product['quantity']; ?>
			]]></search>
            <add trim="true"><![CDATA[
			  <input type="text" class="<?php echo strtolower($column_quantity); ?> editable" name="<?php echo $product['product_id']; ?>_quantity" id="<?php echo $product['product_id']; ?>_quantity" value="<?php echo $product['quantity']; ?>" size="8" onclick='document.getElementById("<?php echo $product['product_id']; ?>_select").setAttribute("checked","checked");' />
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
			  <?php echo $product['model']; ?>
			]]></search>
            <add trim="true"><![CDATA[
			  <input type="text" class="<?php echo strtolower($column_model); ?> editable" name="<?php echo $product['product_id']; ?>_model" id="<?php echo $product['product_id']; ?>_model" value="<?php echo $product['model']; ?>" size="22" onclick='document.getElementById("<?php echo $product['product_id']; ?>_select").setAttribute("checked","checked");' />
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
            <td class="left"><?php echo $product['name']; ?></td>
			]]></search>
            <add trim="true"><![CDATA[
			  <td class="left name"><input type="text" class="editable" name="<?php echo $product['product_id']; ?>_name" id="<?php echo $product['product_id']; ?>_name" value="<?php echo $product['name']; ?>" size="30" onclick='document.getElementById("<?php echo $product['product_id']; ?>_select").setAttribute("checked","checked");' /></td>
		    ]]></add>
        </operation>
		<operation error="skip">
            <search position="replace"><![CDATA[
            <td class="left"><?php echo $product['status']; ?></td>
			]]></search>
            <add trim="true"><![CDATA[
			  <td class="left status"><select name="<?php echo $product['product_id']; ?>_status" id="<?php echo $product['product_id']; ?>_status" onclick='document.getElementById("<?php echo $product['product_id']; ?>_select").setAttribute("checked","checked");'> 
                <?php if ($product['status'] == $text_enabled) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select></td>
		    ]]></add>
        </operation>
        <operation error="skip">
            <search position="after"><![CDATA[
  <div class="heading">
            ]]></search>
            <add trim="true"><![CDATA[
<script type="text/javascript"> 			
$(document).ready(function() {
	$('.editable').focus(function() {
		$(this).addClass("focusField");
        if (this.value == this.defaultValue){
        	this.select();
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    $('.editable').blur(function() {
    	$(this).removeClass("focusField");
        
    });
});


</script>
		    ]]></add>
        </operation>
        <operation error="skip">
            <search position="after"><![CDATA[
  <div class="heading">
            ]]></search>
            <add trim="true"><![CDATA[
<style type="text/css">		
.focusField{
	border:solid 2px #73A6FF!important;
	background:#EFF5FF!important;
	color:#000;
}

.editable{
	background:none;
	color: #000;
	border: none;
	cursor:pointer;
	}
</style>

		    ]]></add>
        </operation>
	</file>
	
	<file name="admin/language/english/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[$_['entry_price']]]></search>
			<add><![CDATA[$_['entry_cost']            = 'Cost Price:';]]></add>
		</operation>
	</file>
	
	<file name="admin/language/portuguese-br/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[$_['entry_price']]]></search>
			<add><![CDATA[$_['entry_cost']            = 'Preco de Custo:<br/><span class="help">Preco de Custo influenciado pela moeda escolhida.</span>';]]></add>
		</operation>
	</file>
	
	<file name="admin/language/english/english.php">
        <operation error="skip">
            <search position="after"><![CDATA[
$_['button_copy']             = 'Copy';
            ]]></search>
            <add trim="true"><![CDATA[
$_['button_simple_pu']             = 'Update Selected';
		    ]]></add>
        </operation>
	</file>
	
	<file name="admin/language/portuguese-br/portuguese-br.php">
        <operation error="skip">
            <search position="after"><![CDATA[
$_['button_copy']             = 'Copiar';
            ]]></search>
            <add trim="true"><![CDATA[
$_['button_simple_pu']             = 'Atualiza';
		    ]]></add>
        </operation>
	</file>
</modification>
#13684
pablovdsp escreveu:Aonde eu instalo amigo? E com que nome? E como eu utilizo ele?
Obrigado.
Instale o vQmod 2.1.5 usando esse tutorial: https://www.opencartbrasil.com.br/artigos/conheca-vqmod/

Depois copie o código acima, cole no notepad++, vá em formatar > UTF-8 (sem BOM), depois salve com qualquer nome, e extensão .xml

Envie esse arquivo .xml para sualoja/vqmod/xml/
#13685
Valeu amigo, mais esse script não funcionou comigo.
Dei uma pesquisada na internet e achei isso aqui:
http://www.opencart.com/index.php?route ... ername=rph

Um modulo para o vqmod que da pra fazer upload por ele mesmo e mostra o console com erros do script.

E achei o post original do cara que fez esse módulo para editar aqui:
http://forum.opencart.com/viewtopic.php ... 0&p=133897

Agora sim funcionou perfeitamente, e obrigado pela ajuda amigo!

Sexy Womans from your town

Resolvido @reds depois de vasculhando alguns[…]

Ola @IronSS Possivelmente o sistema no qual […]

Your lucky day could be today! Enter now!