I want to hide the COMPANY field from the Customer Account dashboard (don't ask why).
I found that the address is generated here:
/app/code/core/Mage/Customer/Model/Customer.php
I created a local version to override the core file and then changed public function getAddressesCollection() to the following:
public function getAddressesCollection()
{
if ($this->_addressesCollection === null) {
$this->_addressesCollection = $this->getAddressCollection()
->setCustomerFilter($this)
//->addAttributeToSelect('*')
->addAttributeToSelect('prefix')
->addAttributeToSelect('firstname')
->addAttributeToSelect('middlename')
->addAttributeToSelect('lastname')
->addAttributeToSelect('suffix')
->addAttributeToSelect('street')
->addAttributeToSelect('city')
->addAttributeToSelect('country_id')
->addAttributeToSelect('region')
->addAttributeToSelect('region_id')
->addAttributeToSelect('postcode')
->addAttributeToSelect('telephone')
->addAttributeToSelect('fax')
->addAttributeToSelect('vat_id')
->addAttributeToSelect('vat_is_valid')
->addAttributeToSelect('vat_request_id')
->addAttributeToSelect('vat_request_date')
->addAttributeToSelect('vat_request_success');
foreach ($this->_addressesCollection as $address) {
$address->setCustomer($this);
}
}
return $this->_addressesCollection;
}
I commented out the addAttributeToSelect('*') and replaced it with every customer_address attribute except for COMPANY.
Is this acceptable? It works but I want to know if it will have any obvious negative impact.
Thanks
Related
I'm working on a moodle module, and when I arrived on this project, the module was already created. The problem is when I'm trying to add it in a course, the module appears in the resources section and I would like to put it in the activities section. How can I do that?
The pop up where I want my module to appear as activity
The code, that separates modules into groups, simply checks the constant prefixed MOD_ARCHETYPE_:
foreach ($modules as $module) {
$activityclass = MOD_CLASS_ACTIVITY;
if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
$activityclass = MOD_CLASS_RESOURCE;
} else if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
// System modules cannot be added by user, do not add to dropdown.
continue;
}
$link = $module->link->out(true, $urlparams);
$activities[$activityclass][$link] = $module->title;
}
As we can see, it simply checks "archetype" property.
Find function YOURMODULENAME_supports in /mod/yourmodulename/lib.php
It should have a string like
case FEATURE_MOD_ARCHETYPE: return MOD_ARCHETYPE_RESOURCE;
Comment it out. The module should now be in activity section (default)
all.
I am trying to disable no-mandatory fields in GLPI. As the application doesn't offer this option, I am trying to change the source code to do it.
This is the piece of code that is related to the mandatory fields:
function getMandatoryMark($field, $force=false) {
if ($force || $this->isMandatoryField($field)) {
return "<span class='red'>*</span>";
}
return '';
}
And this is what I am trying to do:
function getMandatoryMark($field, $force=false) {
if ($force || $this->isMandatoryField($field)) {
return "<span class='red'>*</span>";
}
else{
return "<span onclick='return false;'>*</span>";
}
return '';
}
But when I make this change, create tickets page doesn't load. I am not familiar with PHP so I have no idea what is going on...
No need to edit the files.
Just create a ticket template, name it (e.g. EasyTicket), and make mandatory, add or hide whatever fields you need. I would suggest using Simplified Interface for end users. Less fuss ;)
Manage Templates
Then go to your end users profile (post-only or self-service probably), and choose your Default ticket template (EasyTicket).
I've created a custom page devis and its controller in Prestashop 1.6, but I'm unable to display any columns.
Controller :
class DevisController extends FrontController
{
public $php_self = 'devis';
public $display_column_left = true;
...
}
In Theme configuration, my 'Devis' page appears and the left column is checked :
The "display or not" logic happens in FrontController.php's constructor :
if (isset($this->php_self) && is_object(Context::getContext()->theme)) {
$columns = Context::getContext()->theme->hasColumns($this->php_self);
// Don't use theme tables if not configured in DB
if ($columns) {
$this->display_column_left = $columns['left_column']; // FALSE : why ?
$this->display_column_right = $columns['right_column'];
}
}
I can force the column to display by doing $this->display_column_left = true but it's obviously not the way to do it.
Does someone know why $columns['left_column'] is false ?
Sh*t...
As mentionned by #julien-lachal, the issue was shop-level related.
That means I was browsing the dashboard as "All the shops".
By choosing the desired shop, the left column in theme settings was actually disabled.
Big problems simple fixes...
I apologize in advance for my ignorance of CodeIgniter and the MVC system.
I'm helping a family member with their business website and up until now I've been able to complete most of the required changes just by using logic but now I've hit a dead end. I don't plan to continue supporting them as I'm obviously no CodeIgniter expert. But I'm hoping to leave the website at least functional, so that they can start using it.
I simply want to create a new "page" within the website but it seems impossible. If I can achieve this I think I can figure everything else out on my own.
For example I currently have a "page" for Cancelled Jobs. It the navigation HTML it is linked to like this:
http://localhost/admin/modules/cancelled_jobs
and has a corresponding file here: admin/application/controllers/cancelled_jobs.php
which contains this php code:
class Cancelled_jobs extends CIID_Controller {
public function __construct()
{
parent::__construct();
$this->set_table('job', 'Cancelled Job', 'Cancelled Jobs');
$this->allow_delete = false;
$this->allow_cancel = false;
$this->allow_edit = false;
$this->allow_reactivate = true;
$this->allow_add = false;
$this->overview
->add_item('Job No', 'active', 'job_id')
->add_item('Client', 'active|relationship', 'client.name')
->add_item('Name', 'active', 'name')
->add_item('Status', 'active|relationship', 'job_status.name')
->add_item('Assignee', 'active|relationship', 'team_member.name')
->add_item('Scheduled Date', 'active', 'scheduled_date')
->where("job.cancel_job = '1'")
->order_by('job.created_date DESC');
$this->init();
}
}
I would like to create a new "page" called Closed Jobs.
I've tried copying admin/application/controllers/cancelled_jobs.php and renaming it closed_jobs.php and changing the first line of code to read:
class Closed_jobs extends CIID_Controller {
I then add a link in the navigation HTML:
http://localhost/admin/modules/closed_jobs
However, when clicked, this only results in a "404 Page Not Found" error.
Can anyone point out what I'm missing in the process of creating a new page?
Generally, CodeIgniter URLstructure is:
sitename.com/controller_name/function_name/parameter_1/parameter_2/parameter_3/
You can add as many parameters as you want.
To access
modules/closed_jobs:
Add a new function in the controller modules
function closed_jobs() {
$this->load->view('closed_jobs');
}
And create a view closed_jobs.php
in application/views
Repeat the same for cancelled_jobs
After migrating from Magento Professional to Magento Community, I have encountered an issue when attempting to run the "Apply Rules" function inside of Promotions >> Catalog Price Rules.
The exact message I receive is as follows:
"Unable to apply rules. Invalid website code requested: Array"
Has anyone seen this before? I can't seem to find /any/ information on the error.
Thanks for any help!
In Model App.php
app/code/core/Mage/Core/Model/App.php
public function getWebsite($id=null)
{
if (is_null($id)) {
$id = $this->getStore()->getWebsiteId();
} elseif ($id instanceof Mage_Core_Model_Website) {
return $id;
} elseif ($id === true) {
return $this->_website;
}
if (empty($this->_websites[$id])) {
$website = Mage::getModel('core/website');
if (is_numeric($id)) {
$website->load($id);
if (!$website->hasWebsiteId()) {
throw Mage::exception('Mage_Core', 'Invalid website id requested.');
}
} elseif (is_string($id)) {
$websiteConfig = $this->_config->getNode('websites/'.$id);
if (!$websiteConfig) {
throw Mage::exception('Mage_Core', 'Invalid website code requested: '.$id);
}
$website->loadConfig($id);
}
$this->_websites[$website->getWebsiteId()] = $website;
$this->_websites[$website->getCode()] = $website;
}
return $this->_websites[$id];
}
if you see the line that throw exception Invalid website code requested :$id
This is the exception happen in your case and its because the Price rule assigned to website not exist or wrong id or something related to this.
Try to delete the rule and adding it again.
Could you please check the patches which you migrated to magento community. I hope someting miss coded. Some kind of Array printed during executing code.
https://chat.stackoverflow.com/transcript/message/9332922#9332922
Thanks.
I had the same problem when migrated fro 1.5.1.0 to 1.7.0.2 Magento CE. The problem is with the columns "website_ids" and "customer_group_ids" of the catalogrule table. These columns don't exist in 1.7.0.2 database, but if you try to remove them from a migrated Magento store you will not be able to save any rule. The solution I found is that I assigned NULL value directly in the database for these two columns and afterwards the Apply Rule button worked. However, you need to repeat that job if you save again the rule.