radio button in joomla 2.5 registration form - radio-button

I've made a user profile plugin for Joomla 2.5 using this tutorial link
It works great, but I need the custom field that I added to be a radio button instead of text, because it's a "male/female' option.
Here is how it looks like in /plugins/user/profile10/profiles/profile.xml:
<field
name="gender"
type="text"
id="gender"
description="Male or Female?"
filter="string"
label="Male or Female?"
message="PLG_USER_PROFILE_FIELD_WEB_SITE_MESSAGE"
size="30"
/>
and plugins/user/profile10/profile10.xml:
<field name="register-require_gender" type="list"
description="Your gender"
label="Male or female?"
>
<option value="2">JOPTION_REQUIRED</option>
<option value="1">JOPTION_OPTIONAL</option>
<option value="0">JDISABLED</option>
</field>
I noticed the line type="text" but I'm not sure what I replace it for and where I place both options.
Does anyone know how to do it? Thanks in advance.

According to the Joomla documentation for Standard Form Field Types, you want to use the Radio type. In this case, type would be 'radio' and you would add options for each value specified.

This is the code that I've used:
<field
name="gender"
type="radio"
id="gender"
label="PLG_USER_TESTPROFILE_FIELD_GENDER_LABEL"
default="m">
<option value="m">Male</option>
<option value="f">Female</option>
</field>

Related

Base search is not working for Chart panel

I have created a dashboard with the base search as shown below.
The base search is applied correctly on single panel but in chart panel the base search does not seem to work. The chart panel always shows no result found. But if I give the query directly instead of referencing to base search then the chart panel also works fine.
How do I make sure that chart panel uses the base search?
<search id="base_search_app">
<query>index=something | table msg,timestamp</query>
<earliest>$time.earliest$</earliest>
<latest>$time.latest$</latest>
</search>
<fieldset submitButton="true" autoRun="true">
<input type="time" token="time">
<label>Time Picker</label>
<default>
<earliest>-15m</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<single>
<title>Total created</title>
<search base="base_search_app">
<query>| where like(msg, "%Invoked service%") | stats count</query>
</search>
<option name="colorMode">block</option>
<option name="drilldown">none</option>
<option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0x006d9c"]</option>
<option name="underLabel">No idea when to use this</option>
<option name="useColors">1</option>
</single>
</panel>
</row>
<row>
<panel>
<chart>
<title>Customer response timeline</title>
<search base="base_search_app">
<query>| search msg="*something*" OR msg="*somethingelse*" | timechart count</query>
</search>
<option name="charting.chart">line</option>
<option name="charting.drilldown">none</option>
<option name="height">558</option>
<option name="refresh.display">progressbar</option>
</chart>
</panel>
</row>
The timechart command requires the _time field, which the base search does not provide. The fix depends on the format of the timestamp field. If it's in epoch form then a simple | rename timestamp as _time in the chart panel will do; otherwise, timestamp will have to be converted into epoch form using | eval _time = strptime(timestamp, "<format string>").

How to replace Vendor with Add to Cart button on Slick Slider - Shopify Debut theme?

How can I remove the Vendor name and replace with an Add to Cart button on this Slick carousel? This is for the Shopify Debut Theme. Thanks for your help :)
Follow the below steps for Debut theme for Add to cart button on product grid.
In Shopify Admin select "Online Store" and click on Themes.
Choose your main theme.
Click the . . . on the top left-right (see below) and hit "Edit code" option.
Open Snippets -> "product-card-grid.liquid" File and paste below code at the end of the page code.
Here is that code:
<form method="post" action="/cart/add">
<input type="hidden" name="id" value="{{ product.variants.first.id }}" />
<input min="1" type="number" id="quantity" name="quantity" value="1"/>
<input type="submit" value="Add to cart" class="btn" />
</form>

Looking at the "other" html properties on an element in Selenium

I'm using Selenium to automate some very basic data entry tasks. Sadly I don't have any influence over the site on which the form is hosted.
I have a number of fields on the form that seem to only differ in fields that I don't know how to make Selenium look at. I find all of the fields on the page and can enter text into them as below:
Dim i As Integer = 0
Dim elements = browser.FindElementsByClassName("form-control")
For Each elemnt In elements
Try
elemnt.SendKeys(i)
Catch
End Try
i += 1
Next
Unfortunately this isn't going to be a long-term solution though, as they might change the order of boxes or similar without notifying me. Is there any way to view the whole of the <input ...> tag?
A selection of the inputs are below:
<input class="form-control ng-valid ng-dirty ng-valid-parse ng-touched" data-ng-model="sQuoteName" kdfapp="Quoting" kdfpage="createDeal" kdfid="dealName" style="">
<input kdfapp="quote" kdfpage="quote" kdfid="amEmail" type="text" class="form-control ng-valid ng-dirty ng-valid-parse ng-touched" id="ciscoEmail" data-ng-model="data.suggestAm" placeholder="Email" style="">
<select name="sQuoteType" data-ng-model="sQuoteType" data-ng-change="changeQuoteType();" kdfapp="Quoting" kdfpage="createDeal" kdfid="selectedBuyingBehalf_xxx" class="ng-pristine ng-untouched ng-valid">
<option value="" class="ng-binding">Select</option>
<option value="2" class="ng-binding">Prime Contractor/Systems Integrator</option>
<option data-ng-show="stiEligible" value="1" class="ng-binding ng-hide">Solution Technology Integrator</option>
<option data-ng-show="partner.partnerBuyMthod == 'DIRECT'" value="3" class="ng-binding" style="">IT Service Provider (Outsourcing Deal)</option>
</select>
The most useful descriptor seems to be kdfid=
Please use GetAttribute method to get the Kdfid.
Sample code:
element.GetAttribute("kdfid")

Button add to cart in .tpl of my module on Prestashop

I want to add a button "Add to cart" in my module on Prestashop 1.6.
How to do this please ?
Thanks :)
You can add a button add to cart with ths code:
<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
<!-- hidden -->
<input type="hidden" name="token" value="{$static_token}">
<input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id">
<!-- variants, only use if you plan to have variants -->
{include file="catalog/_partials/product-variants.tpl"}
<!-- qty -->
<input
type="text"
name="qty"
id="quantity_wanted"
value="1"
class="input-group"
min="1"
max="9"
aria-label="{l s='Quantity' d='Shop.Theme.Actions'}"
>
<!-- submit -->
<button
class="btn btn-main add-to-cart"
data-button-action="add-to-cart"
type="submit"
>
Add to cart
</button>
</form>
A click on this button will automatically trigger an ajax call to update the cart with the product represented by the input name="id_product" and the quantity from the input name="qty".
static_token comes from 'static_token' => Tools::getToken(false),, here https://github.com/PrestaShop/PrestaShop/blob/master/classes/controller/FrontController.php#L512
If you want to add variants, you should use PS's standard way:
see catalog/_partials/product-variants.tpl in https://github.com/PrestaShop/PrestaShop/blob/master/themes/classic/templates/catalog/_partials/product-variants.tpl

Shopify cart permalinks: check whether product is in-stock/sold out

I have a customised product.liquid template that includes two products in one template, namely: Bikini Top and Bikini Bottom.
The Bikini Bottom is "externally loaded" into the template using its own cart permalink. My question is, when using cart permalinks, how do I check whether the variant is in-stock or sold out and then display a "sold out" notice if needed?
[EDIT] Below is my cart permalink code for reference:
<form action="/cart/add" method="post" class="variantsform">
<label>Select size</label>
<select name="id">
<option value="1189203320">Small</option>
<option value="1189202416">Medium</option>
<option value="1189200892">Large</option>
<option value="1189203928">Extra Large</option>
</select>
<input type="hidden" name="return_to" value="back" />
<input type="submit" value="Add to cart" class="btn variantsadd">
</form>
at same that you load the variant with liquid, you have to check if is available. Variant manual reference
You also can use the product.first_available_variant