Hello,
I really have many products in my shop and I will like to know how to put a warning when creating a product, if the model already exists in my DB.
Example
I create a product and seized an existing model in my database.
If I did not alert, I can create several times the same product, which is detrimental.
Thank you for your suggestions.
I really have many products in my shop and I will like to know how to put a warning when creating a product, if the model already exists in my DB.
Example
I create a product and seized an existing model in my database.
If I did not alert, I can create several times the same product, which is detrimental.
Thank you for your suggestions.
Last edited by Marco75 on Wed Nov 03, 2010 6:33 pm, edited 1 time in total.
My version > 1.4.9.3
1. EDIT: admin/controller/catalog/product.php
2. FIND (AT THE VERY BOTTOM):
3. BEFORE, ADD:
4. EDIT: admin/view/template/catalog/product_form.tpl
5. FIND:
6. REPLACE WITH:
2. FIND (AT THE VERY BOTTOM):
Code: Select all
}
?>
Code: Select all
public function modelCheck() {
$this->load->model('catalog/product');
$output = '';
$result = $this->getTotalProductsByField('model', $this->request->get['model']);
$output .= '<span id="modelcheck">';
if ($result) {
$output .= 'Model Number Already Exists!';
}
$output .= '</span>';
$this->response->setOutput($output, $this->config->get('config_compression'));
}
private function getTotalProductsByField($field, $value) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product WHERE `" . $field . "` = '" . $value . "'");
return $query->row['total'];
}
5. FIND:
Code: Select all
<input type="text" name="model" value="<?php echo $model; ?>" />
Code: Select all
<input type="text" name="model" value="<?php echo $model; ?>" onchange="$('#modelcheck').remove(); $('#modelwarn').remove(); $(this).after($('<span>').attr('id', 'modelwarn').css('margin-left', '10px').addClass('required').load('index.php?route=catalog/product/modelCheck&token=<?php echo $token; ?>&model=' + escape(this.value)));" />
added it in admin/controller/catalog/product.php
Then put the translation files in admin/languages/LANGUAGE/catalog/product.php
Then I changedBy
But it shows
Code: Select all
$this->data['text_modelcheck'] = $this->language->get('text_modelcheck');
Then I changed
Code: Select all
if ($result) {
$output .= 'Model Number Already Exists!';
}
Code: Select all
if ($result) {
$output .= $this->language->get('text_modelcheck');
}
text_modelcheck
My version > 1.4.9.3
hi.
i am using oc 1.4.9.6
i used location for product code fields
now i want if product location is repeated alert me is repeat
for example
my product1 have location 255541 and saved
i want to when i insert product2 and use location 255541 , alert me is repeated and try again
thanks
i am using oc 1.4.9.6
i used location for product code fields
now i want if product location is repeated alert me is repeat
for example
my product1 have location 255541 and saved
i want to when i insert product2 and use location 255541 , alert me is repeated and try again
thanks
Who is online
Users browsing this forum: No registered users and 1 guest