I have been trying to access a studio field(field created using Odoo Studio) within Qweb to retrive information to put on a template. Here is what I am using
<span>VAT reg. no.: <span t-field="res_company.partner_id.vat" /></span>
<br />
<span>EORI: <span t-field="res_company.partner_id.x_studio_eori_1" /></span>
<br />
<span>Phone: <span t-field="res_company.partner_id.phone" /></span>
<br />
<span>Email: <span t-field="res_company.partner_id.email" /></span>
I can access the VAT, Phone and email fields without an issue but the EORI field is created using Odoo studion and I cannot seem to access it here.
Related
Tried the solution given by another Developer in adding custom fields inside the Shopify theme cart page by generating the fields from here - https://ui-elements-generator.myshopify.com/pages/cart-attribute, and placing them inside the form tags of my Cart template. It works with Debut theme, however, when I tried testing it in Dawn, the form shows but the data never appeared inside my Orders (Admin Panel).
Is there an alternative solution for 2.0 themes, specifically Shopify Dawn theme?
The UI generator mise form="cart" this will make the magic. It will add the element to the cart form no matter where they are on the screen.
Why use that? well, remember the principle on 2.0 is flexibility using blocks, apps blocks, moving it around the screen, organizing differently, etc. form="cart" give this flexibility on the cart page
I use something like that on an app I write to add PO numbers on the orders.
The result using the UI generator should be:
<p class="cart-attribute__field">
<label for="long-custom-text">Long Custom Text</label>
<textarea
required
form="cart"
class="required"
id="long-custom-text"
name="attributes[Long Custom Text]"
>
{{ cart.attributes["Long Custom Text"] }}
</textarea>
</p>
the other very important part is Name the part inside the braquets is how it will appears on the admin side and how you should search the info on the order name="attributes[Long Custom Text]"
You can change what is inside the brackets Long Custom Text but the rest of the name should be there.
<input type="text" name="attributes[other custom Atribute]" form="cart" />
<input type="email" name="attributes[custom email]" form="cart" />
Solution by #chefjuanpi works. I have tried it and it works. Here are the sample fields I have created.
<p class="cart-attribute__field">
<label for="business-name">Business Name</label>
<input form="cart" id="business-name" type="text" name="attributes[Business Name]" value="{{ cart.attributes["Business Name"] }}">
</p>
<p class="cart-attribute__field">
<label for="tagline">Tagline</label><small>(If applicable)</small>
<input form="cart" id="tagline" type="text" name="attributes[Tagline]" value="{{ cart.attributes["Tagline"] }}">
</p>
<p class="cart-attribute__field">
<label for="colors">Colors</label>
<input form="cart" id="colors" type="text" name="attributes[Colors]" value="{{ cart.attributes["Colors"] }}">
</p>
<p class="cart-attribute__field">
<label for="upload">Upload Logo</label>
<input form="cart" id="upload" type="file" name="attributes[Upload]" class="product-form__input">
</p>
In Prestashop I am doing a module. In that module I have view file(smarty template). In smarty I am doing form so that user can submit the form from frontend. Now when user makes fill the form and clicks on submit then the form should save all the vales to thae database. So for that in smarty I made a form like this
<div id="content" class="form-wrapper" >
<div class="form-content">
<input type="text" id="name" name="name" placeholder="Name" /> <br />
<input type="text" id="email" name="email" placeholder="email"/> <br />
<input type="text" id="phone" name="phone" placeholder="Phone Number"/> <br />
<input type="submit" name="submit-query" id="submit-enquiry" value="submit" />
</div>
</div>
and in the file where the values will be submitted I have made my code like this
<?php
include '../../../config/settings.inc.php';
include '../../../config/defines.inc.php';
include '../../../config/config.inc.php';
include(dirname(__FILE__).'/../../../../init.php');
if(Tools::getValue('submit-query')) {
$this->_html .=$this->displayConfirmation($this->l('Settings updated successfully'));
}
else {
$this->_html .= $this->displayError($this->l('You Have Some Errors'));
}
?>
Now when doing click on my submit button It is showing error like this
Fatal error: Using $this when not in object context in file.php on line 11
Now can someone kindly tell me what is the issue here and how can I make a form in smarty for frontend users so that they can submit the form and the value will be stored to the database. Any help and suggestions will be really appreciable. Thanks
First I would recommend to do the processing inside of your module, e.g. in init() function, you can get your module link using $this->context->link->getModuleLink('myModuleName'); and add it to the form action attribute, all variables can be assigned using $this->context->smarty->assign().
Storing values in database is quite a wide question. You have to provide some more details about it.
Check some tutorials from Prestashop e.g. Creating a Prestashop Module. You will find most of your answers there.
Can I debug the below mentioned code on *.cshtml file ? I have used knockout js as my client side java script library.
<div data-bind="ifnot: book()">
<div>
<h2>Add New Book</h2>
</div>
<div>
<label for="name">Name</label>
<input data-bind="value: $root.Name" type="text" title="Name" />
</div>
<div>
<label for="publisher">Publisher</label>
<input data-bind="value: $root.Publisher" type="text" title="Publisher" />
</div>
<div>
<label for="price">Price</label>
<input data-bind="value: $root.Price" type="text" title="Price" />
</div>
<br />
<div>
<button data-bind="click: $root.create">Save</button>
<button data-bind="click: $root.reset">Reset</button>
</div>
</div>
On above code I need to check the values of say "book() or $root.Name ,etc".Can I do that ?
UPDATE:On Fire bug
You'll need to use client side debugging. Either use a developer toolbar (opened with F12 in most browsers) or use Visual Studio Client Script debugging.
After the #nemesv link I did small R&D about this.Below I have mentioned the way you can find the KO binding values of the DOM elements.Hope this will help someone in future.
Link for the Extension : KnockoutJs Context Debugger
The way you can find the KO Values on DOM elements.
Hey I'm try to make a Windows Phone app that logs people in to a webpage, but I'm having trouble getting the app to post the log-in info to the webbrowser.
on the desktop I would have used
HTMLInputElement nameBox = (HTMLInputElement) myDoc.all.item("name", 0);
HTMLInputElement passBox = (HTMLInputElement) myDoc.all.item("pass", 0);
nameBox.value = "textBox1.text";
passBox.value = "textBox2.text;
but the HTMLInputElemet don't exist in Windows Phone.
I also tried using webBrowser1.document but that don't work either on Windows Phone.
It is a log-in using a form and not a query string.
The server side code look like this:
<div class="form-item textfield edit-name">
<div class="label">
<label >E-mail-adresse</label>
</div>
<input type="text" maxlength="60" placeholder="" name="name" id="edit-name" size="60" value="" class="form-text required" /> </div>
<div class="form-item password edit-pass">
<div class="label">
<label >Adgangskode</label>
</div>
<input type="password" name="pass" id="edit-pass" maxlength="128" size="60" class="form-text required" /> </div>
<input type="hidden" name="form_build_id" id="form-b6cb750ff3a79c34d408df98d730a39e" value="form-b6cb750ff3a79c34d408df98d730a39e" />
<input type="hidden" name="form_id" id="edit-user-login" value="user_login" />
<div class="form-actions"><input type="submit" name="op" id="edit-submit" value="Log ind" class="form-submit" />
It is easy in the desktop but I just cant figure out how to do this on the Phone, hope some one can help.
One way to access the fields is using Javascript, thanks to the InvokeScript method:
webBrowser1.InvokeScript("eval", string.Format("document.getElementsByName('name')[0].value='{0}'", "PutTheLoginHere"));
I have some code below:
<div class="product-page-wrapper">
<div class="product-page-img">
<img alt="" width="137" height="125" src="/Portals/6/aggProd.png" />
</div>
<div class="product-page-title">**D-077**</div>
<div class="product-page-desc">
<br />
<br />
<br />
</div>
<div class="product-page-sep">
<img alt="" width="732" height="1" src="/Portals/6/spec-sep.png" />
</div>
</div>
<div class="product-page-spec-title">
Specifications
</div>
<div class="product-page-spec-desc">
<br />
Type -
<span style="color: #1296d3;">
**D-077**
</span>
<br />
<br />
Weight lbs. (kg) - <br />
<br />
Dimensions (mm) -<br />
<span style="color: #1296d3;">
L - **207** W - **175** H - **175**
</span>
</div>
<div class="product-page-spec-button">
<a target="_blank">
<img alt="" width="215" height="64" src="/Portals/6/spec-button.png" />
</a>
</div>
At the moment i am only changing the Product Page Title, Type, Dimemsion values. I have a massive spread sheet with these values and wanted to know if i could input these values into my code automatically.
This would save me alot of time.
what would be the best way?
I am using DNN 5.6.2
Even if i could reproduce the code i could then paste it into my CMS editor.
There are a lot of ways to do this, depending on the tools at your disposal.
One way is to create an ASP.NET page with a repeater in it, and use the OLE DB driver for Excel to use the spreadsheet as a datasource. You can see this question for more details as to how to do it. You could even build such a control into a DotNetNuke module if you want to, then you could have the content update to match the spreadsheet dynamically if the spreadsheet ever changes.
Another approach you could use if you really just want to copy-and-paste the values from the spreadsheet into the CMS, is to use Excel to generate the code. For example, if you're using columns A-E in Excel, you could put a formula like the following in column F:
=CONCATENATE("<div class=""product-page-wrapper""><div class=""product-page-img""><img alt="""" width=""137"" height=""125"" src=""/Portals/6/aggProd.png"" /></div><div class=""product-page-title"">",A2,"</div>", "...etc...")
(This is just an example. You'd have to flesh out the rest of the code, and you might have to use multiple columns to get past string length limitations in Excel)
Then you could paste that formula into every row, and then copy the resulting values from Excel into the CMS text field. This is really a bootleg way of doing things, and writing a DNN module is definitely more ideal, but using Excel functions to generate the code is an option if this is one of those "I need it in 5 minutes and then I'm never going to use it again" situations.