Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD: Double Negative Appearing In Attributes #75

Closed
influxweb opened this issue Oct 17, 2019 · 0 comments · Fixed by #79
Closed

PROD: Double Negative Appearing In Attributes #75

influxweb opened this issue Oct 17, 2019 · 0 comments · Fixed by #79
Assignees
Milestone

Comments

@influxweb
Copy link
Contributor

Expected Behavior

When an attribute has a negative value, there should be only one - in the display.

Current Behavior

When an attribute has a negative value, there is an extra - in the display.
Screen Grab of Issue

Reported on the Miva Forum

Correcting the Issue

In the product attribute template, we are checking for pricing with negative values and changing the layout. However, the inherit - is not being accommodated for. I have added this update and it will be included in the next maintenance release.

To make the update prior to the next release, you will need to update the code in User Interface -> Pages -> PROD -> Product Attribute Template:

<mvt:foreach iterator="attribute" array="attributes">
	<mvt:assign name="l.settings:attribute_ID" value="'l-' $ tolower(l.settings:attribute:code)" />
	<mvt:if expr="l.settings:attribute:required">
		<mvt:assign name="l.settings:required_attribute" value="'required'" />
		<mvt:assign name="l.settings:required_attribute_classes" value="'u-text-bold is-required'" />
	<mvt:else>
		<mvt:assign name="l.settings:required_attribute" value="''" />
		<mvt:assign name="l.settings:required_attribute_classes" value="''" />
	</mvt:if>
	<input data-attribute-type="&mvte:attribute:type;" type="hidden" name="Product_Attributes[&mvte:attribute:index;]:code" value="&mvte:attribute:code;">
	<mvt:if expr="l.settings:attribute:template_code NE 0">
		<input type="hidden" name="Product_Attributes[&mvte:attribute:index;]:template_code" value="&mvte:attribute:template_code;">
	</mvt:if>
	<mvt:if expr="l.settings:attribute:type EQ 'text'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<label class="c-form-label &mvt:required_attribute_classes;" for="&mvt:attribute_ID;" title="&mvte:attribute:prompt;">&mvte:attribute:prompt;</label>
			<input id="&mvt:attribute_ID;" class="c-form-input c-form-input--large" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:attribute:price;" data-regular-price="" type="text" name="Product_Attributes[&mvte:attribute:index;]:value" value="&mvte:attribute:value;" placeholder="" &mvt:required_attribute;>
		</div>
	<mvt:elseif expr="l.settings:attribute:type EQ 'memo'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<label class="c-form-label &mvt:required_attribute_classes;" for="&mvt:attribute_ID;" title="&mvte:attribute:prompt;">&mvte:attribute:prompt;</label>
			<textarea id="&mvt:attribute_ID;" class="c-form-input c-form-input--large c-form-input--long" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:attribute:price;" data-regular-price="" name="Product_Attributes[&mvt:attribute:index;]:value" placeholder="" &mvt:required_attribute;>&mvte:attribute:value;</textarea>
		</div>
	<mvt:elseif expr="l.settings:attribute:type EQ 'radio'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<span class="c-form-label u-block &mvt:required_attribute_classes;" title="&mvte:attribute:prompt;">&mvte:attribute:prompt;</span>
			<mvt:foreach iterator="option" array="attribute:options">
				<label class="c-form-checkbox c-form-checkbox--radio c-form-checkbox--inline" title="&mvt:option:prompt;">
					<mvt:if expr="((g.Product_Attributes[l.settings:attribute:index]:value EQ 0) AND (l.settings:option:id EQ l.settings:attribute:default_id)) OR (g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code)">
						<input class="c-form-checkbox__input" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:option:price;" data-regular-price="" type="radio" name="Product_Attributes[&mvte:attribute:index;]:value" value="&mvte:option:code;" checked &mvt:required_attribute;>
					<mvt:else>
						<input class="c-form-checkbox__input" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:option:price;" data-regular-price="" type="radio" name="Product_Attributes[&mvte:attribute:index;]:value" value="&mvte:option:code;" &mvt:required_attribute;>
					</mvt:if>
					<span class="c-form-checkbox__caption">
						<mvt:if expr="l.settings:option:image">
							<img src="&mvte:option:image;" alt="&mvte:option:prompt;" title="&mvte:option:prompt;" />
						<mvt:else>
							&mvte:option:prompt;
							<mvt:if expr="l.settings:option:price">
								<mvt:if expr="l.settings:option:price GT 0">
									&nbsp;<mvt:eval expr="'+ $' $ rnd(l.settings:option:price, 2)" />
								<mvt:else>
									&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:option:price, 2), '-', '')" />
								</mvt:if>
							</mvt:if>
						</mvt:if>
					</span>
				</label>
			</mvt:foreach>
		</div>
	<mvt:elseif expr="l.settings:attribute:type EQ 'select'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<label class="c-form-label &mvt:required_attribute_classes;" for="&mvt:attribute_ID;" title="&mvt:attribute:prompt;">&mvt:attribute:prompt;</label>
			<div class="c-form-select">
				<select id="&mvt:attribute_ID;" class="c-form-select__dropdown c-form-input--large" data-attribute="&mvte:attribute:code;" name="Product_Attributes[&mvt:attribute:index;]:value" &mvt:required_attribute;>
					<mvt:foreach iterator="option" array="attribute:options">
						<mvt:if expr="((g.Product_Attributes[l.settings:attribute:index]:value EQ 0) AND (l.settings:option:id EQ l.settings:attribute:default_id)) OR (g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code)">
							<option value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="" selected>
								&mvte:option:prompt;
								<mvt:if expr="l.settings:option:price">
									<mvt:if expr="l.settings:option:price GT 0">
										&nbsp;<mvt:eval expr="' +$' $ rnd(l.settings:option:price, 2)" />
									<mvt:else>
										&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:option:price, 2), '-', '')" />
									</mvt:if>
								</mvt:if>
							</option>
						<mvt:else>
							<option value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="">
								&mvte:option:prompt;
								<mvt:if expr="l.settings:option:price">
									<mvt:if expr="l.settings:option:price GT 0">
										&nbsp;<mvt:eval expr="' +$' $ rnd(l.settings:option:price, 2)" />
									<mvt:else>
										&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:option:price, 2), '-', '')" />
									</mvt:if>
								</mvt:if>
							</option>
						</mvt:if>
					</mvt:foreach>
				</select>
			</div>
		</div>
	<mvt:elseif expr="l.settings:attribute:type EQ 'swatch-select'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<label class="c-form-label &mvt:required_attribute_classes;" for="&mvt:attribute_ID;" title="&mvt:attribute:prompt;">&mvt:attribute:prompt; <span data-hook="attribute-swatch-name">&nbsp;</span></label>
			<div class="c-form-select u-hidden">
				<select id="&mvt:attribute_ID;" class="c-form-select__dropdown c-form-input--large" data-attribute="&mvte:attribute:code;" data-hook="attribute-swatch-select" name="Product_Attributes[&mvt:attribute:index;]:value" &mvt:required_attribute;>
					<mvt:foreach iterator="option" array="attribute:options">
						<mvt:if expr="((g.Product_Attributes[l.settings:attribute:index]:value EQ 0) AND (l.settings:option:id EQ l.settings:attribute:default_id)) OR (g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code)">
							<option value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="" selected>
								&mvte:option:prompt;
								<mvt:if expr="l.settings:option:price">
									<mvt:if expr="l.settings:option:price GT 0">
										&nbsp;<mvt:eval expr="' +$' $ rnd(l.settings:option:price, 2)" />
									<mvt:else>
										&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:option:price, 2), '-', '')" />
									</mvt:if>
								</mvt:if>
							</option>
						<mvt:else>
							<option value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="">
								&mvte:option:prompt;
								<mvt:if expr="l.settings:option:price">
									<mvt:if expr="l.settings:option:price GT 0">
										&nbsp;<mvt:eval expr="' +$' $ rnd(l.settings:option:price, 2)" />
									<mvt:else>
										&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:option:price, 2), '-', '')" />
									</mvt:if>
								</mvt:if>
							</option>
						</mvt:if>
					</mvt:foreach>
				</select>
			</div>
			<div id="swatches" class="x-product-layout-purchase__swatches"></div>
		</div>
	<mvt:elseif expr="l.settings:attribute:type EQ 'checkbox'">
		<div class="x-product-layout-purchase__options-attribute o-layout__item">
			<span class="c-form-label u-block">&nbsp;</span>
			<label class="c-form-checkbox &mvt:required_attribute_classes;" title="&mvte:attribute:prompt;">
				<mvt:if expr="g.Product_Attributes[l.settings:attribute:index]:value">
					<input class="c-form-checkbox__input" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:attribute:price;" data-regular-price="" type="checkbox" name="Product_Attributes[&mvte:attribute:index;]:value" value="Yes" checked &mvt:required_attribute;>
				<mvt:else>
					<input class="c-form-checkbox__input" data-attribute="&mvte:attribute:code;" data-option-price="&mvt:attribute:price;" data-regular-price="" type="checkbox" name="Product_Attributes[&mvte:attribute:index;]:value" &mvt:required_attribute;>
				</mvt:if>
				<span class="c-form-checkbox__caption">
					<mvt:if expr="l.settings:attribute:image">
						<img src="&mvte:attribute:image;" alt="&mvte:attribute:prompt;" title="&mvte:attribute:prompt;">
					<mvt:else>
						&mvte:attribute:prompt;
						<mvt:if expr="l.settings:attribute:price">
							<mvt:if expr="l.settings:attribute:price GT 0">
								&nbsp;<mvt:eval expr="' +$' $ rnd(l.settings:attribute:price, 2)" />
							<mvt:else>
								&nbsp;<mvt:eval expr="' -$' $ glosub(rnd(l.settings:attribute:price, 2), '-', '')" />
							</mvt:if>
						</mvt:if>
					</mvt:if>
				</span>
			</label>
		</div>
	</mvt:if>
</mvt:foreach>
<mvt:if expr="l.settings:subscription:enabled AND l.settings:subscription:term_count">
	<div class="x-product-layout-purchase__options-attribute o-layout__item">
		<mvt:if expr="l.settings:subscription:mandatory">
			<label class="c-form-label &mvt:required_attribute_classes;" for="l-subscription" title="Subscribe">Select Subscription</label>
			<div class="c-form-select">
				<select id="l-subscription" class="c-form-select__dropdown c-form-input--large" name="Product_Subscription_Term_ID" &mvt:required_attribute;>
					<mvt:foreach iterator="term" array="subscription:terms">
						<option value="&mvte:term:id;">&mvte:term:descrip;</option>
					</mvt:foreach>
				</select>
			</div>
		<mvt:else>
			<label class="c-form-label" for="l-subscription" title="Subscribe">Select Subscription</label>
			<div class="c-form-select">
				<select id="l-subscription" class="c-form-select__dropdown c-form-input--large" name="Product_Subscription_Term_ID">
					<option value="0">One Time Purchase</option>
					<mvt:foreach iterator="term" array="subscription:terms">
						<option value="&mvte:term:id;">&mvte:term:descrip;</option>
					</mvt:foreach>
				</select>
			</div>
		</mvt:if>
	</div>
</mvt:if>
<input data-hook="product-attribute__count" type="hidden" name="Product_Attribute_Count" value="<mvt:eval expr="miva_array_elements(l.settings:attributes)" />">
@influxweb influxweb added this to the v1.0.6 milestone Oct 17, 2019
@influxweb influxweb self-assigned this Oct 17, 2019
influxweb added a commit that referenced this issue Oct 18, 2019
This maintenance release addresses all issues contained in the v1.0.6 milestone.
https://github.com/mivaecommerce/readytheme-shadows/milestone/7?closed=1

This closes #68, closes #69, closes #70, closes #71, closes #72, closes #73, closes #74, closes #75, closes #76, closes #77, and closes #78
@influxweb influxweb mentioned this issue Oct 18, 2019
influxweb added a commit that referenced this issue Oct 18, 2019
This maintenance release addresses all issues contained in the v1.0.6 milestone.
https://github.com/mivaecommerce/readytheme-shadows/milestone/7?closed=1

This closes #68, closes #69, closes #70, closes #71, closes #72, closes #73, closes #74, closes #75, closes #76, closes #77, and closes #78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant