Donation type styling $this->lists['donation_type']

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #134091 by Russell Leigh
How can we edit the output of donation types ```$this->lists```? I want the text wrapped in a span so I can style the text and label and input properly

I want to achieve something similar to this codepen.io/JiveDig/pen/jbdJXR/

Like I have done with the set amounts on this page ntf.quantumdev.co/donate

But the radios are hard coded. Why are they hard coded?

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #134209 by Mr. Dam
Hi Russell,
I see you already modified a lot in Donation, i just see the Radio buttons on the Payment options. You want to change them?
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #134217 by Russell Leigh
Replied by Russell Leigh on topic Donation type styling $this->lists['donation_type']
Please read my first comment properly, it explains exactly what I want to do

How can we edit the output of donation types ```$this->lists```? I want the text wrapped in a span so I can style the text and label and input properly

I want to achieve something similar to this codepen.io/JiveDig/pen/jbdJXR/

Like I have done with the set amounts on this page ntf.quantumdev.co/donate

But the radios are hard coded. Why are they hard coded?

I want to edit the html of the donation type radios. It is impossible because they are hard coded

The radio input is inside the label. This is poor practice. The radio should be after the label with and id linking them. If you put the radio in the label at least wrap the text in a span so we can access the text via css like "input + span" thn we can make the radio buttons look nice like I have done the amount radios and like in the codepen example

Do you understand now???

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #134218 by Mr. Dam
Hi,
The Donation type has 2 options:
- One time donation
- Recurring donation
Now, we use Joomla core function to define the Donation type radio boxes. If you open file: root -> components -> com_jdonation -> view -> donation -> html.php
You'll code
Code:
$lists['donation_type'] = JHtml::_('select.radiolist', $options, 'donation_type', ' onclick="changeDonationType();" ', 'value', 'text', $donationType);
As you can see, no hard code here.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago - 4 years 7 months ago #134219 by Russell Leigh
Replied by Russell Leigh on topic Donation type styling $this->lists['donation_type']
firstly I can't edit core files as it will get overwritten

Secondly that is hard coded. Because it is inside the php and unable to be edited on the front end in the layout files. Do you not understand what hard coded means?

I've now had to hard code the donation type buttons which is bad practice because if you change something in your plugin it wont change in the front end and will break, but otherwise it is impossible to style the radios.

It is bad practice to do what you have done there. Logic and view should be separated. You should put just the data inside the $lists and the JHtml call should be in the layout file.

All of the joomdonation plugins are poorly coded and use bad practices and are very difficult to customize or make compatible with modern css and bootstrap4. I wont ever use them again
Last edit: 4 years 7 months ago by Russell Leigh.

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #134227 by Mr. Dam
Hi,
To be honest, this is the first time i heard the idea about using Joomla core function is "hard code". But if you want to replace showing variable $lists by HTML with radio boxes (and you will able to change style), you can follow below steps
1. Open file root -> components -> com_jdonation -> view -> donation -> tmpl -> default.php and simpleflow_layout.php (you can make override layouts for them in your template)
2. Find code
Code:
echo $this->lists['donation_type'];
and replace it by below HTML code
Code:
<input type="radio" name="donation_type" id="donation_typeonetime" value="onetime" checked="checked" onclick="changeDonationType();" />Onetime
Code:
<input type="radio" name="donation_type" id="donation_typerecurring" value="recurring" onclick="changeDonationType();" />Recurring

2 code lines above are 2 radio boxes: One time and Recurring donation type. And you can add custom HTML. stylesheet, JS if you want.
I hope my solution will work with you. Let me know if you have any questions about it.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #134229 by Russell Leigh
Replied by Russell Leigh on topic Donation type styling $this->lists['donation_type']
It's not about using the core code. It's about where and how you use it.

I'm starting to understand why the code is so bad in these plugins now... You don't seem to understand coding best practices or the joomla API and code style.

I've already hard coded the radio buttons now, like I said in my previous response. It's not the correct way to fix the problem but I guess it's my only option without refactoring your entire plugin with decent code and logic

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #134230 by Mr. Dam
Maybe Joom Donation has some small problems ( as you think ), but it's not fair when you say "the code is so bad", we are still improving Joom Donation everyday, and new versions are released frequently, the way you value Joom Donation seems to deny our efforts in product development to serve customers. In case you feel Joom Donation isn't good, we can refund money back to you and you can find better products.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Russell Leigh
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #134231 by Russell Leigh
Replied by Russell Leigh on topic Donation type styling $this->lists['donation_type']
I'm only being honest...

I'm kinda stuck with it now, but thanks for the offer.

I won't ever use these plugins or joomla ever again.

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #134232 by Mr. Dam
OK Russell, i am here and ready to help you if you have any further questions
Thanks
Dam

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamDũng Nguyễn Việt