Post by wid » Tue Feb 20, 2018 8:23 pm

oc 3.0.x
after i install a module, how can modification default status be disabled?

i would like to enable (or disable) and rebuild my modification cache after i install and enable a module from Extension menu.
i can use this code so as to enable it.
$this->model_setting_modification->enableModification(my_modification_id);
$this->response->redirect($this->url->link('marketplace/modification/refresh', 'user_token=' . $this->session->data['user_token'] , true));

take a visit to My Modules !


wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by wid » Wed Feb 21, 2018 3:45 am

i am asking if there is a way of making default stautus of a modification "disabled"
if i install a module which has modification, events and a creation of a new lookup table for example
it will want to be installed so as to create the table, activate the events and make the modifiactions,
if only modification is enabled it will occure some mistakes.

why you can control events and other things from installation and not the status of a modification?

take a visit to My Modules !


wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by wid » Fri Feb 23, 2018 6:29 pm

i believe that i can solve my problem if i use the install.php file in foo.ocmod.zip
can anyone give me an example of the content of this file (install.php) which it will be in a custom extention?
i cannot find any documentation about the stracture of this file.

i would like this to happen:
after i install a module, its modification to be disabled?

to run this code inside install.php
$this->model_setting_modification->disableModification(my_modification_id);

take a visit to My Modules !


wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by wid » Fri Feb 23, 2018 7:50 pm

as i can see in v2.3.x inside *.ocmod.zip you could have those files:
install.sql
install.xml
install.php
/upload forlder

but now in v3.0.* you can only have install.xml and /upload forlder

so i dont believe that is a solution to my question

--
the only way is to use a fix so as to do it by altering a file
FILE: admin/controller/marketplace/install.php
LINE: 318
CODE ADD:

Code: Select all

$status= $dom->getElementsByTagName('status')->item(0);
if ($status) {
	$status = $status->nodeValue;
} else {
	$status = 1;
}
LINE: 330
CODE REPLACE:

Code: Select all

'status'               => 1
to
'status'               => $status
and inside install.xml use this tag
<modification>
<status>0</status>

--
Conclution:
it use' s $status as a variable $data['status'] when oc adds the modification
ModelSettingModification->addModification($data)
why not to be programmers choice to be 1 or 0 (enabled or disabled) ?

can i request this as fix for new oc version??

take a visit to My Modules !


wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece
Who is online

Users browsing this forum: DigitCart and 16 guests