Add product field to cart opencart - opencart

In opencart, at success page, i need to check product's specific field value to take an action. Specifically field: stock_status_id.
WHen i use
$this->cart->getSubTotal()
and
$this->session->data['order_id']
i can get sku, name, category, price, quantity fields but when i try to get stock_status_id field using this code:
$product['stock_status_id']
i don't get anything. I opened system/library/cart.php file and added to data array stock_status_id with no success.
Any help is appreciated!

Found it! Its in system/library/cart.php look for:
$this->data[$key] = array
and add a line with the field you want to bring!

Related

How to add data to manytomanyfield in drf

enter image description here
enter image description here
enter image description here
So I have a 2 models with a manytomany field. A book might be created without a publisher. When a publisher is added, I want to add it to the Books model with respect to its id any help is much appreciated
Suppose A is ManyToManyField and AA is the model, then -
First crate the instance:
Object = AA.object.create(validated_data)
then:
Object.A.add(value_to_be_added)
Now this is the guess work. Write your code for a detailed answer.
You can also use remove method to remove data from manytomanyfield.

Dropdown values customization in NetSuite

There is a custom record type configured in NS. It has a name and a free-form text field called full_name. Name is a standard field, full_name is a custom field. There is another record type which has a field of type List/Record with the previous type. On the form this field is present as drop-down. The drop-down show names of records. The goal is to show full names instead of names in the drop-down. Is it possible to mark somehow full_name field so it is available in the drop-down view instead of just name? Any ideas how to achieve this with NS?
Depending on your exact needs, it may make sense to add another custom field to the record containing your drop down. You can source this field from the full_name field on the custom record. This field does not need to store the value if it's only for display purposes.
Add a new field to the record containing the drop down
Set the type to be text
Name it appropriately
Under the 'Sourcing and Filtering' tab, set the source by field to the drop down
A field with type List/Record type can only show standard Name field. However, you can create a custom field dynamically on before record load of a user event script. Check the nlobjForm.addField. Please keep in mind that the value of it will not be saved. Saving the value is another story.

how to match a field name with another field name

I have two fields that run throughout a website that I would like to match so that when a user inputs a value either of the fields, it will match the other field. I'm using Sitecore Rocks and am trying to use a query to do this.
select ##h1#, ##Title#
from /sitecore/Content/Home//*[##h1# !="##Title#"];
update set ##h1# = ##Title# from /sitecore/Content/Home//*[##Title# = "<id>"];
What am I missing here?
This article talks about tapping in to the item:saving event which allows you to compare the fields values of the item before and after the changes:
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2010/11/Intercepting-Item-Updates-with-Sitecore.aspx
Using this, you can determine which field has been amended, then change the other to match.
I've had to do something similar to this when a new field was added, and we wanted to set the initial value equal to an existing field. It may be a bug in Sitecore Rocks, but I found it would only update a field when a static value was part of the query.
When I ran ##h1# = ##Title#, the query analyzer would return the correct number of items updated, but no values were actually updated. However, ##h1# = '<id>' worked perfectly. After trying a number of things, I found this did what I wanted.
update set ##h1# = '' + ##Title# from /sitecore/Content/Home//*[##Title# = "<id>"];
I hope that helps.

change sequence vtiger basic field in contact add form

I want that field should enter first and then other field . i am try through move the location in edit layout option and save the sequences. but when i click on add contact the set sequence not view in create contact form.
can you guide thee process for change the sequences of basic field .
Thanks & regards
Nitesh Shah
if you are not bale to change the field order from layout editor, then change the value of column "sequence" in vtiger_field table

Trying to filter the contents of a ChoiceField

(My english no is good, sorry) I have a problem creating a form of search by location: I have the form.py currently as follows:
from models import City, Zone
class SearchForm1(forms.Form):
cityf = forms.ModelChoiceField(queryset=City.objects.all(), empty_label="none")
zonef = forms.ModelChoiceField(queryset=Zone.objects.all(), empty_label="none")
But this is displayed with all cities and areas exist in the db, and I'm trying to make is that in the 1 st field is show all cities and in the 2nd field to display only those areas corresponding to the selected city.
I tried to do so:
class SearchForm1(forms.Form):
cityf = forms.ModelChoiceField(queryset=City.objects.all(), empty_label="none")
zonef = forms.ModelChoiceField(queryset=City.objects.get(
name_city="cityf").zone_set.all(), empty_label="none")
^ But I recive this ##ERROR: ^
Exception Type: DoesNotExist
Exception Value:
City matching query does not exist.
Exception Location:
I've also been looking at this: http://www.stereoplex.com/blog/filtering-dropdown-lists-in-the-django-admin But in the end it does not need to leave it someone can help me out?
You can't do this. Since at the time the form gets rendered, the city (the first field) is not selected yet.
You could either do it in a two-step wizard-style form. Where the first form only has the city, then the second form only the zone. In the second form you filter the zones using the city that was selected in the first form.
Alternatively you could to it using javascript where you filter the second field depending on the first field.
You probably want to use the feature Grouped Selects in django smart selects. Check out this answer to a duplicate question:
https://stackoverflow.com/a/8390892/538471