I want to modify one attribute of my product automatically (code). How could i do that plz?
I have seen how to show one attribute, but not how to modify.
Thx
if attribute name is "attr" and product is loaded into object $product
$product->setAttr($value);
$product->save();
Related
I have a property sheet having two pages. The first page contains an edit box (EDITBOX1)and a check box (CHECKBOX1) . The second page contains also contains an edit box(EDITBOX2) with a check box(CHECKBOX2).
I am trying to implement a way that when there is no value in EDITBOX1 and EDITBOX2 have some value CHECKBOX2 should be checked and it should be dithered .
Then when we entered somevalue to EDITBOX1 the previously checked CHECKBOX2 should not be checked and dithered.
Can anyone suggest me some implementation? Any suggestion is appreciated.
Thanks a lot!
Derive your own class from CPropertySheet. Override CPropertySheet::OnActivatePage. Set the appropriate page how you want when it is activated.
Include your pages in your MyPropertySheet.h file. Declare your pages (CPropertyPage m_Page1, CPropertyPage m_Page2, ..) - as many as you need - in the MyPropertySheet.h file.
Add the pages to your CPropertySheet in the class constructor in MyPropertySheet.cpp file with method
CPropertySheet::AddPage(&m_Page);
Get parent of your CPropertySheet in MyPropertyPage2.cpp such as:
CMyPropertySheet* pSheet = (CMyPropertySheet*)GetParent();
Reach your m_Page1 controls pSheet->m_Page1.GetDlgItem(CHECKBOX2) from m_Page2.
Currently I work with screen ap303000.aspx. I want to add new attribute to tab "Attributes". This tab is binded to view "Answers" which is declared in following way:
[PXViewName(CR.Messages.Answers)]
public CRAttributeList<Vendor> Answers;
little bit digging with metadata viewer in CRAttributeList shows that CRAttributeList is inherited from PXSelectBase and definitely reads records from CSAnswers table:
public class CRAttributeList<TReference> : PXSelectBase<CSAnswers> where TReference : IBqlTable
which gives me hint, that I need to insert something into table CSAnswers. Table CSAnswers by it's structure also doesn't give me enough information what should I put in table CSAnswers in order to have some attribute as bool and available to all Vendors and to turn it on by default?
You need to specify list of Attributes at Vendor Class (AP201000) level first.
Once Vendor class is specified, Attributes specified at Class level will be listed for which value can be assigned.
Like I have added one boolean type attribute into Product table.so I want to filter on that attribute basis on my plp page.
Please have a look at your solr.impex file.
You can add a new SolrIndexedProperty eg: 'onSale' using below code:
INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier)[unique=true];name[unique=true];type(code);sortableType(code);currency[default=false];localized[default=false];multiValue[default=false];facet[default=true];facetType(code);useForSpellchecking[default=false];useForAutocomplete[default=false];fieldValueProvider;valueProviderParameter
;$solrIndexedType; onSale ;boolean; ; ;true ; ; ;MultiSelectOr ;true;true;springELValueProvider;
Setting the value of attribute 'onSale' can be done where other values are being set. Please do a full solr indexing after running the impex.
Is there a quick way to populate a UIPickerView with values?
I have the picker in a XIB all by itself, and when the view is displayed, I would like to have the UIPickerView populated.
Would someone please enlighten me!!
thanks
tony
You need to create a class derived from UIPickerViewModel, supplying implementations for GetComponentCount/GetRowsInComponent/GetTitle.
Then, in the controller associated with your nib, assign the "Model" property of your picker to an instance of your UIPickerViewModel derivation.
I have created a custom field type as it is there in sharepoint OOTB, the difference is only that the end user does not need to check the name i.e I have replaced it with DropDownList. The dropdownlist suggest the no. of users available in the web site for that I have created a FieldClass which inherits from SPFieldUser and a FieldControlClass which inherits from UserField. It is working fine in all conditions i.e when I create a List or Document Libarary it shows me the DropDownList
with respective users after saying OK it creates an item for me. I have overriden a Value property in FieldControlClass as follows,
public override object Value
{
get
{
SPUserCollection userscollection = rootWeb.SiteUsers;
//ddlInfoBox is a DropDownList to which I have Binded the collection of users in the form of string
SPUser user = userscollection.Web.EnsureUser(this.ddlInfoBox.SelectedValue);
SPFieldUserValue userval = new SPFieldUserValue(user.ParentWeb, user.ID, user.LoginName);
return userval;
}
set
{
SPFieldUserValue userval = (SPFieldUserValue) this.ItemFieldValue;
this.ddlInfoBox.SelectedValue = userval.Lookupvalue; //Here look up value is nothing but a Login name e.g In-Wai-Svr2\tjagtap
}
}
Due to above property the Custom Field's Value for this current ListItem will be stored as SPFieldUserValue e.g 27#;In-Wai-Svr2\tjagtap.
The main problem is here, when this particular ListItem is shown in the list page views e.g on AllItems.aspx or the custom view pages associated with it, it shows the
number as 27 as a FieldValue insted of HyperLink with text as "In-Wai-Svr2\tjagtap" and PostBackURL as "/_layouts/userdisp.aspx?ID=27".
When I edit this Item it makes the respective value selected in the dropdownlist, also while viewing this item i.e on DispForm.aspx it also shows the hyperlink. I have
acheived it by writting a custom logic in createchildcontrol() method i.e by using ControlMode if it is New or Edit then fill the dropdown list, if it is Display then get the ItemFieldValue Type Cast it into SPFieldUserValue and get corresponding lookupid and value for making the URL and showing Text of the HyperLink.
I have spent a lot of time on searching and bringing the HyperLink as the user name with navigation insted of UserID (27) as a string on the list view pages e.g AllItem.aspx but to no avail, then after a lot of research I found that there might be a way of achieving such kind of functionality by using field type definition xml file where there is a provision to define a DisplayPatteren as you wish by specifying the html code. But here is a problem How can I get the UserID (27) with respective UserName e.g In-Wai-Svr2\tjagtap inorder to make an anchor tag like In-Wai-Svr2\tjagtap which will solve my problem. I have hard coded this anchor tag within the Default case statement of a switch under DisplayPatteren but it shows me the field value on AllItems.aspx as
In-Wai-Svr2\tjagtap27 i.e the value defined in xml file is concatenating with the string value (27).
Please help me to resolve the above mentioned 2 issue. I am really in need of solving this problem ASAP.
Thanks & Regards,
Tejas Jagtap
Have u tried to override the GetFieldValueAsHtml() method in the the custom field class or maybe the RenderFieldForDisplay() method in the custom field control class.
Can you use the DisplayPattern CAML from the User field type?