Shopify - Contact Form Country and Province - shopify

I'm using the following code to add a country dropdown to a contact form based on the method here
<label for="ContactFormCountry" class="label--hidden">{{ 'contact.form.country' | t }}</label>
<select required id="ContactFormCountry" name="contact[country]" data-default="{{form.country}}">{{ country_option_tags }}</select>
How would I go about making another dropdown menu allowing for choosing the province of the selected country?

Related

vuejs model not updating when using an address lookup

I am using a postcode search service to populate address form fields.
When an address is selected, the form fields are populated correctly, i.e. town is in town field etc.
Problem is, it doesn't update the model.
<div class="form-group address">
<label for="postcodeFormField">Postcode *</label>
<input name="postcode" v-model="contact.postcode" type="text" class="form-control" id="postcodeFormField" placeholder="SW7 3RX" required>
</div>
If I manually type into the fields, it does update the model. But the address data which displays in the form fields after an address is selected, is not being reflected in the model.
Add a ref to the input i.e ref="postcodeFormField"
Hit a method on submit button #click="myMethod()"
In that method:this.$refs.postcodeFormField.dispatchEvent(new Event('input'));

Add countries in form field Prestashop 1.7.x

I am trying to display a dropdown with all the countries that prestashop has in his database.
When a customer is adding a new address, a field ask for the country, but displays only United States.
How can I make to display all the countries?
Because when I edit the customer I can see all the countries.
What I have tried:
In the location: /public_html/Project/themes/myTemplate/templates/_partials/form-fields.tpl
I realized there is a Foreach to fill the dropdown, but load United States.
{elseif $field.type === 'countrySelect'}
{block name='form_field_item_country'}
<select
class="custom-select js-country"
name="{$field.name}"
{if $field.required}required{/if}
>
<option value disabled selected>{$field.label}</option>
{foreach from=$field.availableValues item="label" key="value"}
<option value="{$value}" {if $value eq $field.value} selected {/if}>{$label}</option>
{/foreach}
</select>
{/block}
I can see in console, actually, loads one value only.
Could anybody has the same error?
How can you help me to fix it?
Go in International > Locations , check Countries tab and make sure the other countries are active (they aren't in a standard US / UK Prestashop installation)

How Can I add currency selector on WHMCS custom page?

I am trying to add a currency selector on one of my custom pages where I have displayed the product details.
I want to allow my visitor to change the default currency from this custom page and view the product pricing accordingly.
I have added this code in my custom.tpl
<input type="hidden" name="token" value="{$LANG.go}">
<select name="currency" onchange="submit()" class="form-control">
<option value="">Change Currency (A$ AUD)</option>
{foreach from=$currencies item=listcurr}
<option value="{$listcurr.id}"{if $listcurr.id == $currency.id} selected{/if}>{$listcurr.prefix} {$listcurr.code}</option>
{/foreach}
</select>
</form> ```
But it is not working, every time I select the currency from the dropdown, it refreshes the page. but nothing changes,
please guide what I am doing wrong.
Thanks in advance
Aqsa,
You can do this. You could update your form to either:
Perform a GET request, and add the currency=$id parameter to the URL ($id being the ID for the currency in tblcurrencies.
Or
When your form submits, handle the form input, and set the currency in the session variable:
use WHMCS\Session;
Session::set('currency', $id);
Again, where $id relates to tblcurrencies.id.
Bare in mind that the currency cannot be changed for existing users, and it is not recommended changing their currency after they have made any transactions to avoid accounting/calculation issues.

prestashop where is subcategories query

Hello I am using menu for mobile for prestashop 1.6 website.
I want to shange displayed name of categories.
I created name2 field for ps_category_lang table and filled with shorter category names. I want to show short names af mobile menu.
{foreach $subcategories as $subcategory}
{if ($subcategory->id|escape:'htmlall':'UTF-8') ne '45'}
<li {if count($subcategory->getChildrenWs())}class="icon-arrow"{/if}>
<a
class="rm-level__item rm-category-{$subcategory->id|intval}"
{if $subcategory->nright > $subcategory->nleft +1}data-load="{$subcategory->id|escape:'htmlall':'UTF-8'}"{/if}
href="{$subcategory->getLink()|escape:'htmlall':'UTF-8'}"
>{$subcategory->name|escape:'htmlall':'UTF-8'}</a>
</li>
{/if}
when I change $subcategory->name to $subcategory->name2 menu shows empty category names.
https://addons.prestashop.com/en/mobile/17310-menu-for-mobile.html
where this subcategories created?
You also have to modify (preferably and most recommended, override) the Category.php (in classes) class and add the field name2 in the Lang fields definition of the model.

Can I add the custom fields to the product listing page in BigCommerce

Each product has the custom fields options. Can I output those custom fields on each product item in the product list page? If so, how? I have tried adding the ProductOtherDetails and the %%SNIPPET_ProductCustomFieldItem%% in the CategoryProductsItem.html, but got no output at all of any of the items I have tried. Any suggestions or pointers on how and if this is possible?
As of September 2015, you can now access %%GLOBAL_ProductCustomFields%% on any template file that renders a particular panel's individual items. For example:
-Snippets/CategoryProductsItem.html for category list pages
-Snippets/HomeFeaturedProductsItem.html for the featured products panel
I recommend adding the custom field name as a class to each field for easy hiding, and accessing of the value in case the custom fields ever change you won't be accessing them via :nth-child CSS which would break. You can do so by modify Snippets/ProductCustomFieldItem.html to add the custom field name to the CSS class or ID like this:
<div class="DetailRow %%GLOBAL_CustomFieldName%%">
<div class="Label">%%GLOBAL_CustomFieldName%%:</div>
<div class="Value">
%%GLOBAL_CustomFieldValue%%
</div>
</div>​
Doing so, will output like this in each item in the category list.
Above, I am using the custom fields to send through shipping time, as well as "Starting At" to prepend to the list page price if the item is a parent which has children of higher prices. In my opinion, these features greatly increase the user experience.
For Faceted Search (handlebars.js)
I recommend adding this to Panels/FacetedSearchProductGrid.html:
{{#each product.custom_fields}}
{{ id }} : {{ name }} : {{ value }}
{{/each}}
Those filters will be limited to the Product pages specifically. The only way around it is to hash together a solution using jQuery to go and fetch items in question from the product page. A pain, but do-able with unnecessary effort.