How do I add user-chosen price to cart? (google checkout) - google-checkout

This example shows how to add a field to let customers to choose their own price. But the button in that example is for fast checkout. I am trying to add the customer-chosen price to cart? How do I do this?
The code that I have (google app engine - python) adds the item to the cart but not the price; the price is always zero. This is the code I am using:
self.response.out.write("""
$ <input type="text" name="item_price_1"/>
<div class="product">
<input type="hidden" class="product-title" value="%s">
<input type="hidden" class="product-attr-id" value="id#%s">
<div class="googlecart-add-button" tabindex="0" role="button" title="Add to cart">
</div></div>
And this is the sandbox script:
#sandbox script
self.response.out.write("""<script id='googlecart-script' type='text/javascript' src='https://checkout.google.com/seller/gsc/v2_2/cart.js?mid=1234567890' integration='jscart-wizard' post-cart-to-sandbox='true' currency='USD' productWeightUnits='LB'></script> """)

I solved the problem:
According to documentation, javascript to add the items to cart only processes
elements that appear within a tag that uses the CSS product class.
For example, in the HTML snippet above, if the price (and the
product-price class) appeared outside of the element,
the shopping cart JavaScript would not identify a price for the item.
So added $ <input type="text" name="item_price_1"/> inside the <div class="product"> as class="product-price":
<div class="product">
<input type="hidden" class="product-title" value="%s">
$ <input type="text" class="product-price" name="item_price_1"/>
<input type="hidden" class="product-attr-id" value="id#%s">
<div class="googlecart-add-button" tabindex="0" role="button" title="Add to cart">
</div></div>

Related

How to use multidimensional checkbox v-model in vuejs

Suppose i have some subjects which has conditions and groups.
How can i load those first time and checked in update mood in vuejs?
<div v-for="(sub, Index) in subjects">
<b>{{ sub }} </b>
<label v-for="(subconlist) in sub['subCon']">
<input type="checkbox"
:value="subconlist.id"
:key="subconlist.id"
>
<span>{{subconlist.name}} </span>
</label>
<label v-for="clsgrlist in sublist['acGr']">
<input type="checkbox">
<span>{{clsgrlist.academic_group_name}} </span>
</label>
</div>
<button #click="saveOrUpdate()" >Save </button>
</div>
fiddle here
the table where i will save it : sub_id,condition_ids,group_ids
I have to save data based on checked value in the table with comma separated.
How can i get checkbox checked if it already found in the table, i mean when update?
I need to get subjectconditon or group ids basis on each subject when click on save button.

Recognize multiple object using single xpath using attributes H3 and label text

I'm trying to recognize two objects on two different UI using a dynamic xpath.
So object are as in snippet:
<div class="reports-filter">
<ul id="portfolio-input--temp-ddisable">
<li>
<h3 class='reportOptions'><label>Enter Account Number</label></h3>
<input id="name2" name="name2" type="text" value="" size="20"/>
</li>
</ul>
<input type="hidden" name="secure" value="true"/>
</div>
<div class="multiCol">
<h3 class='reportOptions'><label>Account Number </label></h3>
<input id="reportFilters17.typeSpecific.string" name="reportFilters[17].typeSpecific.string" class="textFilter" type="text" value=""/>
</div>
Now i tried used following xpath but to no luck
//h3[contains(text(),'Account Number$']
//h3[contains(.,'Account Number$']
//h3[#class='reportOptions']
//h3[#class='reportOptions']/text()
//label[contains(.,'Account Number$')]
.//*[contains(text(),'Account Number$')]
why are you using $ in contains function if you want to check end with number then use matches and second thing use //h3[#class='reportOptions']/label or //h3[#class='reportOptions']/label/text()

view new div based on option value of select tag using laravel

i have a dropdown list when i select any one option from list i should display an another form with name of the teacher and subject of the teacher in textbox.The form is not displaying.when i select one item it should display the selected name and description box to add subjects of teachers that they interested please help me
view page
<div class="portlet light bordered row">
<h1>Add teacher subject</h1>
<div class="row">
<form action = "{{ url('subjectby/adding/process') }}" method = "POST">
{{ csrf_field() }}
<div class= "col-md-12">
<div class="form-group">
<h3>Choose Teachers </h3>
<div class="input-group">
<div class="ui-widget border-dropdown" style="margin-left:50px;">
<select id="teacher" name="teachers" placeholder="Select Teacher">
<option value="">Select Teacher</option>
#foreach($user as $tec)
<option value="{{$tec->id}}">{{$tec->name}}</option>
#endforeach
</select>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="new">
<div class="form-group">
<div class="col-sm-6">
<label for="inputFacebook">Teacher Name</label>
<input type=hidden value="{{$tec->id}}" name="id">
<input type="text" value="{{$tec->name}}" class="form-control" name="name">
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label for="inputDescription">Subject Interested</label>
<textarea class="form-control" rows="8" name="intr" placeholder="Enter Subject Interest"> </textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<input type="submit" value="add" name=b1>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
This isn't a Laravel specific problem. You are taking about DOM manipulation and so you best bet is to use jQuery or Vuejs or even vanilla Javascript if you so choose. Basically, you will write a script to watch for when your <select> changes, and then based on it's new value, show the part of the form you want.
Keep in mind that Laravel is a backend framework and so the user will never interact with it on a page. After a page loads, Laravel has done all it can do until another request is made. This is why Javascript was born - to let the user change things without reloading the page.

Put check this checkbox with selenium in ruby programing

I would like to put check this checkbox with selenium in ruby programing.
but i can`t do put check. how should I do?
Now, I make below code.
# code
element = #driver.find_element(:xpath, '//*
[#id="lookCheck10"]/div[1]/div[2]/div[1]/label')
#driver.execute_script("arguments[0].click();", element);
# html
<div class="e-select-box p-look-bike__type-box">
<div class="e-title">
<input type="hidden" name="data[Reserve][types][10]"
id="lookCheck10_" value="0"/><input type="checkbox"
name="data[Reserve][types][10]" id="lookCheck10" value="1"
checked="checked"/> <label
for="lookCheck10">BIKE</label>
</div>
<div class="e-media">
<div class="e-media__body p-look-bike__type-detail">
<p>this is good for family</p>
</div>
<div class="e-media__image p-look-bike__type-image">
<img src="/images/reserve/img_biketype_10.jpg" alt="bike">
</div>
</div>
</div>
I am assuming you want to select a checkbox with label 'BIKE'. For that, use below code-
element = #driver.find_element(:xpath, '//*[#id="lookCheck10"]')
#driver.execute_script("arguments[0].click();", element);

Dollar sign followed by a curly bracket inside widget html

I am currently on the Helsinki Release
Cannot understand the purpose of dollar sign and curly braces inside label tag
<label class="control-label" for="inputSuccess">${Location}</label>
The full html of the weather widget:
<form class="form-inline well">
<div class="form-group" ng-class="{'has-error': (c.errorMessage), 'has-success': (c.channel)}">
<label class="control-label" for="inputSuccess">${Location}</label>
<input type="text" class="form-control" id="weatherInput" placeholder="{{::data.enterLocMsg}}" ng-model="c.data.place">
<button type="submit" class="btn btn-default" ng-click="c.getWeather();">${Go}</button>
<span class="help-block" ng-bind="c.errorMessage" ng-if="c.errorMessage"></span>
</div>
</form>
<div class="panel panel-default" ng-if="c.channel">
<div class="panel-body">
<p>${Location}: {{c.channel.location.city}}, {{c.channel.location.region}} {{c.location.country}}</p>
<p>${Temperature}: {{c.channel.item.condition.temp}}</p>
<p>${Condition}: {{c.channel.item.condition.text}}</p>
<p>{{c.channel.item.condition.date}}</p>
</div>
</div>
From ServiceNow Product Dokumentation
Use the HTML template to internationalize strings in a widget.
Writing text as ${message} is the equivalent of writing ${gs.getMessage("message")} in other parts of the system, but written as a more legible shorthand.

Resources