Opencart product.tpl - opencart

Where did I miss to add a line of code if I try to echo php variable inside OPENCART product.tpl file and it doesn't show up on site?
Notes: there is a field in database. I am able to save to this field from admin panel ( i added a custom field there).

Did You edit also the product controller to load the variable and pass it to the template? I guess not... Edit catalog/controller/product/product.php and add $this->data['MYVARIABLE'] = $product_info['MYVARIABLE']; somewhere before $this->render() is called.

Related

ckeditor field shows html tags in content only when value not changed

I am supporting an ember site that was build by someone else. The frontend is Emberjs with a Drupal 7 backend.
The site has a user profile where they can enter a bio. The initial bio entry is fine, but if the user edits the profile (changes some other field for example) but does not change the bio text, then it saves something like <p>My bio</p>as the value of the field where the html tags are saved as text.
The component.js for the form has this in it:
bodyChanged(newValue) {
this.get('profile').set('bio', newValue);
},
Suspecting this is the culprit but not sure what to do to fix.
Thanks
I found the problem. My deserializing function that sucks in the drupal json was using json[fieldName]['und'][0]['safe_value']; as the value. When I switched it to use the json[fieldName]['und'][0]['value']; the problem went away.

Drupal 8 hook_form_alter not called in the search block form

I am trying to modify the form action of the search block in my Drupal 8 project. The search block is placed in the Primary menu area. I added the following code in my .theme file
function mytheme_form_alter(&$form, FormStateInterface $form_state, $form_id) {
echo 'my search form'.$form_id;
}
This form alter is not called when the page is loaded.
I tried adding form_alter in my custom module. It is also not working. Any ideas?
I found the answer. We can change the form action in block--search.html.twig file in the theme folder.
You cannot use hook_form_alter in the theme, only in the modules

Custom fields in confirmation email Opencart 2.0

I have created custom fields for my registration/checkout form with Opencart 2.0. They show up on the admin section under each order, and I have successfully added them to the order_invoice.tpl, but I need to add them to the confirmation email that is sent to the customer. I think I have located the correct controller file: catalog>controller>account>order.tpl But I think the issue is that the code used to print it out in the order_invoice.tpl is referencing a folder or file in the admin side.
This is the code I am trying to execute in catalog>view>theme>yourtheme>template>mail>order.tpl
<?php foreach ($account_custom_fields as $custom_field) { ?>
<strong><?php echo $custom_field['name']; ?></strong>:
<?php echo $custom_field['value']; ?><br />
<?php } ?>
This is the error I get:
Notice: Undefined variable: account_custom_fields in
/home/raphaelseventworks.com/www/ncbaorders/catalog/view/theme/journal2/template/mail/order.tpl
on line 70Warning: Invalid argument supplied for foreach() in
/home/raphaelseventworks.com/www/ncbaorders/catalog/view/theme/journal2/template/mail/order.tpl
on line 70
Does anyone know how print out custom fields in the order confirmation email? Or what code I need to add to catalog>controller>account>order.tpl to make this work?
Thanks!
If i am correct you are trying to send additional values to confirmation email after checkout
you need to work on
catalog/model/checkout/order.php::addOrderHistory()
After order is placed, the order history is changed, here you can load your view file and pass custom values form controller according to your need.
Good Luck

Remove "Name" field from Joomla registration form

I would like to remove the Name field in the Joomla registration form.
I have tried editing the /com_users/models/forms/registration.xml
I've tried removing the field from the XML file and I've also tried to set it as 'optional'. Neither of these work. The is a registration failed message in the next page in either case.
Found the instructions http://www.2createthatwebsite.com/tutorials/joomla-tutorials/remove-fields-joomla-registration-form
You need to edit the libraries/joomla/database/table/user.php file.
You need to edit the check() function.
In my case, I added a:
$this->name=$this->username;
at the beginning of the check function, that sets the username as the name, juse before saving.

How do I change the template of the Mailchimp Wordpress widget?

I want to change how the form looks like and the labels on the fields of the form.
Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There's a dropdown menu labeled "Select plugin to edit". Click that and select "MailChimp" and then click the "Select" button. The sidebar widget form is called mailchimp/mailchimp_widget.php
The form's code begins right after the first PHP block.
You can also edit the code directly by looking in the wordpress/wp-content/plugins/mailchimp/ directory. The translations are in the po sub-directory.
The trick with this template is that the fields are loaded from elsewhere. In order to change the label, you have to set the option of the fields in the PHP code. Each field is looped through and printed out automatically.
For example to change the "Email Address" label to read "Email" add the following code at the end of the first PHP block:
$mv[0]['name'] = 'Email';
This assumes that the first field that will be printed out is the Email Address field. You can do a var_dump to see what other options are available.
If you want to make more drastic changes to the form, remember that when the widget is updated, you'll have to make the changes again and merge them with the updated version.