Post by shahab7073 » Thu Sep 12, 2019 1:29 pm

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

Newbie

Posts

Joined
Thu Jan 03, 2019 11:55 am

Post by xxvirusxx » Thu Sep 12, 2019 2:33 pm

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'];

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by shahab7073 » Thu Sep 12, 2019 4:46 pm

xxvirusxx wrote:
Thu Sep 12, 2019 2:33 pm
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'];
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'];

Newbie

Posts

Joined
Thu Jan 03, 2019 11:55 am

Post by xxvirusxx » Thu Sep 12, 2019 6:21 pm

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.

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by shahab7073 » Fri Sep 13, 2019 8:24 pm

xxvirusxx wrote:
Thu Sep 12, 2019 6:21 pm
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.
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

Newbie

Posts

Joined
Thu Jan 03, 2019 11:55 am

Post by xxvirusxx » Fri Sep 13, 2019 9:47 pm

If you pay attention you can duplicate the name field in what you want.

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by shahab7073 » Sat Sep 14, 2019 3:15 am

xxvirusxx wrote:
Fri Sep 13, 2019 9:47 pm
If you pay attention you can duplicate the name field in what you want.
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

Newbie

Posts

Joined
Thu Jan 03, 2019 11:55 am

Post by xxvirusxx » Sat Sep 14, 2019 2:36 pm

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

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Who is online

Users browsing this forum: No registered users and 2 guests