I have added a product in opencart with 0 quantity but when I see it in front end then I want to show out of stock text and the add to cart button should also be disabled
Note : It's not recommended to make the direct changes in the core
files. You can make the vqmod for the same changes. changes given here
are tested in the default template, it might be different in other
custom theme.
Before
After
(1) Open catalog/controller/product/product.php (approx line num : 273) and search for the line:
if ($product_info['quantity'] <= 0) {
and make the changes as below:
$data['stock_qty']=1;
if ($product_info['quantity'] <= 0) {
$data['stock'] = $product_info['stock_status'];
$data['stock_qty']=0;
} elseif ($this->config->get('config_stock_display')) {
$data['stock'] = $product_info['quantity'];
} else {
$data['stock'] = $this->language->get('text_instock');
}
(2) Open catalog/view/theme/default/template/product/product.tpl (approx line num 303 to 309)
and wrap the block of "add to cart button" inside the condition.
<?php if($stock_qty!=0) { ?>
<div class="form-group">
<label class="control-label" for="input-quantity"><?php echo $entry_qty; ?></label>
<input type="text" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="form-control" />
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
<br />
<button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>
</div>
<?php } ?>
In the administrative dashboard;
Hover over the menu bar where it says SYSTEM and then click on
SETTINGS in the drop-down menu.
Select the STORE that you wish to edit and then click on EDIT on the
far right to proceed.
Click on the TAB that says OPTION, then scroll down until you see the
option labeled SHOW OUT-OF-STOCK WARNING.
Related
Is it possible to adjust / remove entry fields on registration page?
Image:
In admin panel go to Customer > Custom Field
Here you can add any custom field you want. Just check Required before saving new field, and enable it. After that you will see it in your registration page.
Removing unnecessary field, like Fax
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group">
<label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
<div class="col-sm-10">
<input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-fax" class="form-control" />
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="fax" value="" />
Removing necessary field, like Address
Do everything from the previous chapter
Open catalog/view/theme/default/template/account/register.tpl
Find following
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-address-1"><?php echo $entry_address_1; ?></label>
<div class="col-sm-10">
<input type="text" name="address_1" value="<?php echo $address_1; ?>" placeholder="<?php echo $entry_address_1; ?>" id="input-address-1" class="form-control" />
<?php if ($error_address_1) { ?>
<div class="text-danger"><?php echo $error_address_1; ?></div>
<?php } ?>
</div>
</div>
Replace it with following (using same name="fax" as above)
<input type="hidden" name="address_1" value="" />
Now open catalog/controller/account/register.php
Find private function validate() {, Inside of this function we can see all validations.
Look for
if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
$this->error['address_1'] = $this->language->get('error_address_1');
}
and remove (or comment) it.
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-telephone1">Confirm Telephone</label>
<div class="col-sm-10">
<input type="tel" name="telephone1" value="" placeholder="Confirm Telephone" id="input-telephone1" class="form-control" required/>
<?php if ($error_telephone1) { ?>
<div class="text-danger"><?php echo $error_telephone1; ?></div>
<?php } ?>
</div>
</div>
I am getting an error message even though I have already defined a variable in language and controller. Error message is given below:
errorNotice: Undefined variable: error_telephone1 in /home/chaarms/public_html/catalog/view/theme/default/template/account/register.tpl on line 85
in corresponding controller file, in your case catalog/controller/account/register.php you should define it:
$data['error_telephone1'] = "some code where from you want to get this info";
for example if you want to add some text code should be next:
$data['error_telephone1'] = $this->language->get('error_telephone1');
and in corresponding language file add:
$_['error_telephone1'] = 'Telephone error!!!';
that's all.
Hi I'm trying to click on this button that stays disabled until you fill in other fields. I am working with firefox. My script fills out those fields and the button is now clickable with my mouse. But when I try to click that element through selenium I get an error
WebDriverException: Message: Element is not clickable at point (281.8333282470703, 14.149993896484375). Other element would receive the click: <li ng-class="{active: $state.includes('urlAdm')}" id="adm-menu"></li>
Here is the html for the button.
<div class="col-xs-offset-2 col-xs-5">
<button type="submit" class="btn btn-primary ng-binding" ng-disabled="!userForm.$valid || user.deleted_at" disabled="disabled">
<i class="fa fa-check-square-o fa-fw"></i>
Create
</button>
<!-- ngIf: isAddUser() --><button ng-if="isAddUser()" type="button" class="btn btn-default ng-scope" ng-click="resetForm()">
<i class="fa fa-eraser fa-fw"></i>
Clear
</button><!-- end ngIf: isAddUser() -->
<!-- ngIf: !user.deleted_at && user.id !== currentUser.id && user.id -->
<!-- ngIf: user.deleted_at -->
</div>
I've tried regularly clicking on the button and doing it through actions but neither work.
Here is the code
element = driver.find_element_by_xpath("//*[#id='user-editor-1']/form/div[5]/div/button[1]")
ActionChains(driver).move_to_element(element).click().perform()
Any help would be greatly appreciated. Thanks!
You should try to click using execute_script() as below :-
element = driver.find_element_by_xpath("//button[contains(.,'Create')]")
driver.execute_script("arguments[0].click();",element)
Hope it helps....:)
i create new template for j2.5,
i need to add many module only show on home,
now i need to show many module all page without home,
pleas see my code below :
<div class="row" style="margin-top:20px;">
<div class="col-xs-12 co-md-12">
<?php if($this->countModules('adsright')) : ?>
<div class="col-xs-12 col-md-2">
<jdoc:include type="modules" name="adsright" style="custom" />
</div>
<?php endif; ?>
<div class="col-xs-12 col-md-10">
<div class="content">
<jdoc:include type="message" />
<jdoc:include type="component" /> </div></div>
</div>
</div>
when add module to adsright position and unchecked home page,was not show on my content,
how can i solve that ?
please tell me full way for create position conditional.
thanks.
please give some clear description of your problem.
And if you want certain positions and div structure on home page and not require same on inner pages then you can set condition based on this code. I hope this will help.
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'Home page';
}
i want to add an option with select control about send mail to customer or not when admin add new order or edit the existing order. and i have trouble with using API.
i added this :
<div class="form-group">
<label class="col-sm-2 control-label" for="input-mailcontrol"><?php echo $entry_email; ?><span data-toggle="tooltip" title="<?php echo $button_shipping; ?>" data-loading-text="<?php echo $text_loading; ?>" </span></label>
<div class="col-sm-10">
<select name="mailcontrol" id="input-mailcontrol" class="form-control">
<?php if ($mailcontrol) { ?>
<option value="1" selected="selected"><?php echo $text_enabled; ?></option>
<option value="0"><?php echo $text_disabled; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_enabled; ?></option>
<option value="0" selected="selected"><?php echo $text_disabled; ?></option>
<?php } ?>
</select>
</div>
</div>
and also these:
$('#tab-customer input[name=\'mailcontrol\']').val(item['mailcontrol']);
and i added everywhere that i see the customer fields.
but still i can not reach that data on the api side. always having same error about there is no such data.
thank you for your helps.
i solved problem with custom fields, i added radio controls with custom fields and checked this custom fields about send mail or not send.
catalog-model-checkout line 605.
$mail_control=$this->db->query("SELECT * from order where order_id='".(int)$order_id."'");
foreach($mail_control->rows as $m){
$t=$m['custom_field'];}
if (!$this->model_payment_amazon_checkout->isAmazonOrder($order_info['order_id']) && strpos($t,"3")){ // 3= custom_field_id