×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: CMC & template override

CMC & template override 10 years 11 months ago #24047

  • Elvis
  • Elvis's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi!

I have a template override for user registration and checkbox (in fact whole fieldset) for mailchimp subscription doesn't appear.
Because of the site specifics I'm calling registration form fields separately like this:
<?php echo $this->form->getLabel('address'); ?>
<?php echo $this->form->getInput('address'); ?>

Of course, checkbox is shown if using default registration page without template override.
I've looked inside com_cmc code and tried to figure out what to change to get this working, but without success.
I saw function build() in helpers/xmlbuilder.php but didn't get any further.

I would really need this and would need a little guidance/help from your side.
I guess it would help all the others that are using template overrides.

Thanks!

CMC & template override 10 years 10 months ago #24175

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Elvis,
So actually we extend the default registration form. If you do var_dump($this->form) you should see all the mailchimp fields in there. You can call them separately.

Cheers,
Daniel

CMC & template override 10 years 7 months ago #25733

  • Elvis
  • Elvis's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi!

I have put this project of mine to the side, but now I want to move on.
Like you said, CMC fields are there.
But if I called them separately like this
<?php echo $this->form->getLabel('cmc_newsletter'); ?>
and
<?php echo $this->form->getInput('cmc_listid'); ?>
they aren't displayed.

I saw a little difference in field rendering between Joomla core fields and CMC fields when using default registration:
Joomla fields are rendered like
<input type="text" name="jform[city]" id="jform_city" value="" class="required" size="30"/>
and then I call them like this:
<?php echo $this->form->getLabel('city'); ?>
But CMC fields have additional value [cmc] inside name tag:
<input type="checkbox" name="jform[cmc][newsletter]" id="jform_cmc_newsletter" value="1" class="inputbox cmc-checkboxes cmc-checkbox-subscribe">
Is this the reason why these fields aren't displayed if I call them the way I did?
What am I missing?

CMC & template override 10 years 6 months ago #25758

  • Elvis
  • Elvis's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I've managed to solve this.
I missed two important things:
  1. There is a hidden field which CMC uses (cmc_listid)
  2. I've forgot to create fields in com_users/models/forms xml files

So fields are displayed in registration and profile views, I didn't test yet, if mailchimp works, but I don't see any reason why it shouldn't.
  • Page:
  • 1
Time to create page: 0.186 seconds