I just need a widget with a textarea where I can paste an embed code. Right now, whenever I save the widget, it auto removes the html codes.
<label for="<?php echo $this->get_field_id( 'embed' ); ?>"><?php _e( 'Embed:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'embed' ); ?>" name="<?php echo $this->get_field_name( 'embed' ); ?>" type="text" value="<?php echo esc_attr( $embed ); ?>" />
It should work like the default text-widget where it runs HTML. Any way I can put a certain code to retain and run the HTML in my custom widget?
Please use the default textwidget, it will serve your purposes.
Related
I am working on a solution for the task to display a customer number in the order confirmation email.
There is already a custom attribute customer_number which is displayed in the register form and the customers back-end.
It seems to get displayed by calling a helper.
This is how it is displayed in the register form:
<input type="number"
name="<?php echo Company_Helper_Data :: CUSTOMER_NUMBER_FIELD ?>"
id="<?php echo Company_Helper_Data :: CUSTOMER_NUMBER_FIELD . "id" ?>"
value="<?php echo $this->escapeHtml($this->getFormData()->getData( Company_Helper_Data :: CUSTOMER_NUMBER_FIELD ) ) ?>"
title="<?php echo $this->__('Customer Number') ?>" class="input-text" />
This is how it gets called in the customer back-end
<input type="text"
name="customer_number"
id="customer_number"
value="<?php echo $this->getCustomer()->getCustomerNumber() ?>"
title="<?php echo $this->__(' Customer Number') ?>"
class="input-text" />
So I simply tried to put this code into the order/default.phmtl:
<?php echo $this->getCustomer()->getCustomerNumber()?>
Which does not work. The Order cannot be set.
I am rookie to programming. Does anyone has an idea how to call the customer-data in the order email-template and display it in the order confirmation?
For this in Magento, you'll have to go in magento backend admin panel,
next go to
system=>Transactional Emails
Here you'll find your email template.
After this open the email template and then place this where you would like
{{ var customer_number }}
I am creating my first online shop.
Problem: I want to show, error message for quantity validation.
Stock quantity is not showing in product detail page but it is showing in cart page. I have share both pages screenshot below.
Product Detail: http://prntscr.com/93ajnj
Cart: http://prntscr.com/93ajuk
I have use below code in woocommerce > single-product > add-to-cart > variable.php
<div class="quantity"><strong>Quantity </strong>
<input type="number" step="<?php echo esc_attr( $step ); ?>" <?php if ( is_numeric( $min_value ) ) : ?>min="<?php echo esc_attr( $min_value ); ?>"<?php endif; ?> <?php if ( is_numeric( $max_value ) ) : ?>max="<?php echo esc_attr( $max_value ); ?>"<?php endif; ?> name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" class="input-text qty text" size="4" oninvalid="setCustomValidity('Sorry! we have only <?php echo esc_attr( $max_value ); ?> shirts in your selected size.')"
onchange="try{setCustomValidity('')}catch(e){}" />
</div>
Any help in this regards will be highly appreciated. Thanks in advance.
P.S. link of website.
I am using Magento Community in order to develop a webshop. I am creating products with a dropdown custom option. I have been trying to change the display (HTML) of this information. Basically, I would like to display a table instead of the dropdown menu that appears currently, but I do not know how to do it. The file I have tried to edit is located in app/design/frontend/base/default/template/bundle/catalog/product/view/type/bundle/option. What I understood is that the information is inserted using the following code:
<?php endif; ?>
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
<?php else:?>
<select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
<option value=""><?php echo $this->__('Choose a selection...') ?></option>
<?php foreach ($_selections as $_selection): ?>
<?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>
<?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
<?php endif; ?>
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?></option>
<?php endforeach; ?>
</select>
What I tried to do is to get the information while building a table, so I added some lines at the end of the tag in order to see a table under the dropdown, with all the information, something as basic as the following lines:
<table class="probapifa">
<?php foreach ($_selections as $_selection1): ?>
<tr id="rowpifa" value="<?php echo $_selection1->getSelectionId() ?>"><?php echo $this->getSelectionTitlePrice($_selection1, false) ?></tr>
<?php endforeach; ?>
</table>
The result is unappreciated, as I can see nothing even if I select a new option from the dropdown. Also, I can see that in the code above, it says Choose a product for the initial selected option, when in the product site the text that appears is Please select. (I read it should be edited in the CSV file, right?). So my guess is that I am not editing the right file, what should I do? I really need your help.
on the line where the error apparently is the code looks like this:
<?php if ($filter_name) { ?>
I know this is probably a vague questions but if anyone can help that would be great!
This is very Vague question. most probably you would be getting this error in header.tpl because you are using theme made for 1.5.4.x ( or earlier) with 1.5.5.x
in your catalog/view/theme/your_theme/template/common/header.tpl
Find
<?php if ($filter_name) { ?>
<input type="text" name="filter_name" value="<?php echo $filter_name; ?>" />
<?php } else { ?>
<input type="text" name="filter_name" value="<?php echo $text_search; ?>" onclick="this.value = '';" onkeydown="this.style.color = '#000000';" />
<?php } ?>
replace with
<input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" />
If you would have searched before asking you would have found this http://forum.opencart.com/viewtopic.php?f=20&t=97790
go to path : catalog/view/theme/your_theme/template/common/header.tpl
open the file header.tpl
search <?php if($filter_name) { ?>
replace above by <?php if(isset($filter_name)) { ?>
yes , it is a version defect , its common when u use a 1.5.4 theme for 1.5.5 version , but u can solve it easily (if one or two errors) using the above stated method. only this file needs to be changed : catalog/view/theme/your-theme/template/common/header.tpl , and dont crack up the core files for safety .
https://github.com/justinmarsan/opencart-blank-theme/issues/7
This link really helped me,
Just replace
This:
<?php if ($filter_name) { ?>
With This:
<?php if (isset($filter_name)) { ?>
Please help, I can't understand why the code below keeps bringing me to viewcart.php when I click on the textbox that is used to input qty to buy, I made sure to close all the anchor tags in the page. I even removed all the links to viewcart.php but no luck:
<form name="cx" method="get" action="viewcart.php?action=add&id=<?php $pid; ?>">
<?php
while($row=mysql_fetch_assoc($result)){
$pid=$row['PID'];
?>
<tr>
<td><?php echo $row['PID']; ?></td>
<td> <?php echo $row['PRODUCT']; ?></td>
<td><?php echo $row['CATEGORY']; ?></td>
<td><?php echo $row['P_DESC']; ?></td>
<td><?php echo $row['QTYHAND']; ?></td>
<td><?php echo $row['S_PRICE']; ?></td>
<input type="hidden" value="<?php echo $row['QTYHAND']; ?>" name="qoh[]"/>
<input type="hidden" value="<?php echo $row['S_PRICE']; ?>" name="sprice[]"/>
<?php echo "<td><img src=\"../img/system/add-icon.png\"></td>"; ?>
<td><input type="checkbox" name="sc[]" id="<?php echo $row['PID'];?>" value="<?php echo $row['PID']; ?>"></input></td>
<td><input type="text" name="qbuys[]" value="" id="qb"></input></td> <!--when I click on this, it seems like I'm clicking on a link to viewcart.php -->
</table>
<input type="submit" value="submit"></input>
</form>
I removed some of the code which I don't think is useful in solving this problem. Please help. Thanks.
Your code has two issues. YOu're not echoing the $pid and you have a scoping error.
<form name="cx" method="get" action="viewcart.php?action=add&id=<?php $pid; ?>">
You need to add an echo:
<form name="cx" method="get" action="viewcart.php?action=add&id=<?php echo $pid; ?>">
Also, $pid doesn't exists until you're inside the while loop so you'll always be echoing '':
// $pid == null;
<form name="cx" method="get" action="viewcart.php?action=add&id=<?php $pid; ?>">
<?php
while($row=mysql_fetch_assoc($result)){
$pid=$row['PID']; // NOW $pid has a value
?>
If you view the source of this page you should see:
<form name="cx" method="get" action="viewcart.php?action=add&id=">
Notice the empty id. This would keep sending you back to viewcart.php
You are not echoing your $pid into the form action.
This means that when you submit your form it is not going where you expect.
action="viewcart.php?action=add&id=<?php echo $pid; ?>"
or
action="viewcart.php?action=add&id=<?=$pid?>"
This second examle will only work if your server has short tags enabled.
Rather than looking at the PHP code that generates the page, i would suggest loading the page in your browser, and then clicking "view source". That way you can see exactly what code is being generated, then work back from there to identify which statement is going wrong.
However, I would suggest looking at the following line:
<td> <?php echo $row['PRODUCT']; ?></td>
There is no echo on the 'Product' property.