I added 2 new input to opencart admin controller for manufactor-info page and add a column to database manufactor table and add some code in model. i want to get the value from the input and show it on front-end of manufactor page. But the value of input when user set value or text/url value not save on input and when I echo the value nothings show up
this is my code for admin manufactor.php controller file .
language data
$data['entry_linktolid'] = $this->language->get('entry_linktolid'); $data['entry_khadamat'] = $this->language->get('entry_khadamat');
$data['help_linktolid'] = $this->language->get('help_linktolid');
$data['help_khadamat'] = $this->language->get('help_khadamat');
then add this to manufactor.php
if (isset($this->request->post['linktolid'])) {
$data['linktolid'] = $this->request->post['linktolid'];
} elseif (!empty($product_info)) {
$data['linktolid'] = $product_info['linktolid'];
} else {
$data['linktolid'] = '';
}
if (isset($this->request->post['khadamat'])) {
$data['khadamat'] = $this->request->post['khadamat'];
} elseif (!empty($product_info)) {
$data['khadamat'] = $product_info['khadamat'];
} else {
$data['khadamat'] = '';
}
and in the model file i added this
$this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['information_description']) . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE manufacturer_id = '" . (int)$manufacturer_id . "'"). "', linktolid = '" . $this->db->escape($data['linktolid']). "', khadamat = '" . $this->db->escape($data['khadamat']);
I wanted to value of input that we insert save in db and define it as variable and echo it on front end
this is my code for admin manufactor.php controller file .
language data
$data['entry_linktolid'] = $this->language->get('entry_linktolid'); $data['entry_khadamat'] = $this->language->get('entry_khadamat');
$data['help_linktolid'] = $this->language->get('help_linktolid');
$data['help_khadamat'] = $this->language->get('help_khadamat');
then add this to manufactor.php
if (isset($this->request->post['linktolid'])) {
$data['linktolid'] = $this->request->post['linktolid'];
} elseif (!empty($product_info)) {
$data['linktolid'] = $product_info['linktolid'];
} else {
$data['linktolid'] = '';
}
if (isset($this->request->post['khadamat'])) {
$data['khadamat'] = $this->request->post['khadamat'];
} elseif (!empty($product_info)) {
$data['khadamat'] = $product_info['khadamat'];
} else {
$data['khadamat'] = '';
}
and in the model file i added this
$this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET name = '" . $this->db->escape($data['name']) . "', description = '" . $this->db->escape($data['information_description']) . "', sort_order = '" . (int)$data['sort_order'] . "' WHERE manufacturer_id = '" . (int)$manufacturer_id . "'"). "', linktolid = '" . $this->db->escape($data['linktolid']). "', khadamat = '" . $this->db->escape($data['khadamat']);
I wanted to value of input that we insert save in db and define it as variable and echo it on front end
Change this } elseif (!empty($product_info)) { to this } elseif (!empty($manufacturer_info)) {
And this $data['linktolid'] = $product_info['linktolid']; to $data['linktolid'] = $manufacturer_info['linktolid'];
And this $data['linktolid'] = $product_info['linktolid']; to $data['linktolid'] = $manufacturer_info['linktolid'];
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
thank you i did that but it's not working when i put the text or url in input after i save it, it disappear and when i open the manufacture in admin the link or text no longer there. i think it nor get data from db. what can i do ?!
i added this code to
catalog/controller/product/manufactur | after the $manufacturer_info = ...
so can use $linktolid in tpl file of catalog/product/manufacture.tpl but nothing shows up.
#data['linktolid'] = $manufacturer_info['linktolid'];
You have altered dabase table and added this? linktolid
You want to add that from manufacturer form?
If yes, then you need to add also on getForm() controller function
Should be easy if you pay attention on Name field.
You want to add that from manufacturer form?
If yes, then you need to add also on getForm() controller function
Should be easy if you pay attention on Name field.
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
yes i created the database column named linktolid
yes i want to add from manufacturer info in admin and show in font page manufactur.tpl
what is exactly i need to add on getfrom()?
and thank you for you time and help
If you pay attention you can duplicate the name field in what you want.
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
i did attention and duplicate all the code part related to entry but still no success i'm almost work on iot about 3 days part time but still coudm't find out why i will appreciate you if you help and say what i need to do , i'm almost new to opencart
What 2.x version you use?
To work you need to add code in:
Admin:
- admin/controller/catalog/manufacturer.php
- admin/model/caralog/manufacturer.php
- admin/language/xx-xx/catalog/manufacturer.php
- admin/view/template/catalog/manufacturer_form.tpl
Catalog
- catalog/view/theme/theme_name/product/manufacturer_info.tpl
To work you need to add code in:
Admin:
- admin/controller/catalog/manufacturer.php
- admin/model/caralog/manufacturer.php
- admin/language/xx-xx/catalog/manufacturer.php
- admin/view/template/catalog/manufacturer_form.tpl
Catalog
- catalog/view/theme/theme_name/product/manufacturer_info.tpl
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Who is online
Users browsing this forum: No registered users and 5 guests