I am performing CRUD operations for products of e-commerce site in kentico 10.I can add and update products using below API
SKUInfoProvider.SetSKUInfo(updateProduct);
Also there is an API for deleting product
SKUInfoProvider.DeleteSKUInfo(updateProduct);
But I do not wish to delete the product from database,rather just disable them so that they do not show up to the end users and still stay in the database .
This are the SKU Objects for the product :
var sku = new SKUInfo
{
//SKUName = Convert.ToString(dr["SHORT_DESCRIPTION"]).Trim('"') + " (" + Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]) + ")",
SKUName = Convert.ToString(dr["MANUFACTURER_PART_NUMBER"]),
SKUDescription = Convert.ToString(dr["TECHNICAL_SPECIFICATIONS"]).Trim('"'),
SKUShortDescription = Convert.ToString(dr["SHORT_DESCRIPTION"]).Trim('"'),
SKUPrice = ValidationHelper.GetDouble(dr["RESELLER_BUY_INC"], 0),
SKURetailPrice = ValidationHelper.GetDouble(dr["RRP_INC"], 0),
SKUEnabled = true,
SKUSiteID = siteId,
SKUProductType = SKUProductTypeEnum.Product,
SKUManufacturerID = manufacturer.ManufacturerID,
SKUDepartmentID = department.DepartmentID,
SKUHeight = 100,
SKUWidth = 100,
SKUAvailableItems = 1,
SKUSellOnlyAvailable = true
};
I tried to set SKUEnabled as false but still user can see the product.So, is there any property to disable products ?
How are you displaying the Sku? If it's a repeater, you may need to filter by the "SKUEnabled = 1" in your where condition.
Another option is if the Product has a Page (it's not a stand alone sku) you can unpublish the page itself.
Well... A user doesn't see products per say - he sees pages that are connected to your SKUs/products. When you disable the SKU - the page is still visible, but (if I am not mistaken) "Add To Cart" is not shown. You need to unpublish product pages. You need to set DocumentPublishTo of the document to some date before for ex:
ProductNode.SetValue("DocumentPublishTo", DateTime.Now.AddDays(-1));
Related
I am attempting to create open purchase orders in Netsuite during a system migration using Netsuite's PHP Toolkit for 2019_2. I am able to create the purchase order and line items without a problem, but I cannot figure out how to change the item cost on the line item. Setting the line item extended total works, but setting the rate field does not. Can anyone shed any light on why the price is not being set?
I've tried both $poi->item->rate = "5.00"; and $poi->item->rate = 5.00; with no success. The documentation says that this field is a string.
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/schema/other/purchaseorderitem.html
$service = new NetSuiteService();
$po = new PurchaseOrder();
$po->tranId = 'PO111111';
$po->tranDate = '2019-03-27T00:00:00';
$po->approvalStatus = new RecordRef();
$po->approvalStatus->internalId = 2;
$po->entity = new RecordRef();
$po->entity->externalId = 'VENDORNAME';
// Create PO Item
$poi = new PurchaseOrderItem();
$poi->item = new RecordRef();
$poi->item->externalId = 'ITEMNUMBER';
$poi->item->rate = "5.00";
$poi->quantity = 10;
$po->itemList = new PurchaseOrderItemList();
$po->itemList->item = array($poi);
$request = new AddRequest();
$request->record = $po;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
print_r($addResponse);
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
Set the rate on the purchase order line instead of trying to do it on the item record.
$poi->rate = "5.00";
My application allows multiple sales quotes to go out in a single pdf packet. At the bottom of each quote is an Accept (quote#) Decline (quote#) radio group. Using the DocuSign API I am attaching a radio group to each of these accept/decline sections on each quote. There is no "required" option at the group level so I set "required" on one of the radio's which makes the group required.
This all works great except the signing flow through the document. If I choose "Accept" which is the first radio and hit "Next" it changes to "Choose" and seems to want me to choose "Decline" as well. If I hit "Choose" it moves on to the next radio group. If I choose "Decline" it moves on to the next radio group as it should (I assume because its the last radio item in the group). If I am at the last radio group I can choose "Accept" and its finished.
It seems like a bug to me since you can only choose a single radio group item, doing so with required should fulfill this requirement with any selection. I would like it to move on to the next radio group after either selection. Has anyone run into this issue and found a work around or solution?
for (var i = 0; i < parts.Count; i++) {
Radio approve = new Radio();
approve.AnchorString = "Accept " + parts[i].Substring(0,parts[i].Length-3) + "-" + parts[i].Substring(parts[i].Length-2,2); approve.Value = "Accept";
approve.Required = "true";
approve.AnchorMatchWholeWord = "true";
approve.AnchorUnits = "pixels";
approve.AnchorXOffset = "-19";
approve.AnchorYOffset = "-4";
Radio decline = new Radio();
decline.AnchorString = "Decline " + parts[i].Substring(0,parts[i].Length-3) + "-" + parts[i].Substring(parts[i].Length-2,2); decline.Value = "Decline";
decline.AnchorMatchWholeWord = "true";
decline.AnchorUnits = "pixels";
decline.AnchorXOffset = "-19";
decline.AnchorYOffset = "-4";
List<Radio> radioVals = new List<Radio>();
radioVals.Add(approve);
radioVals.Add(decline);
RadioGroup rg = new RadioGroup();
rg.GroupName = parts[i].Substring(0,parts[i].Length-3) + "-" + parts[i].Substring(parts[i].Length-2,2);
rg.Radios = radioVals;
signer.Tabs.RadioGroupTabs.Add(rg);
}
Please see the DocuSign blog post Guide Your Signers Through Documents with the Auto-Navigation Feature
We are setting up the document to have an optional text field. We are using DocuSign SOAP API.
We have added Tab configuration, with anchor string, to specify details of custom Text box. The text box appears in the document, but it's always mandatory. Here is the configuration which we setup.
I have gone through various DocuSign support tickets, and community but couldn't find a solution for the same. Please let us know if there is anything missing, or we have a workaround for the same.
I don't see the definition of CustomTabRequiredSpecified in wsdl.
Snippet
Tab.RecipientID = "1"
Tab.DocumentID = "1"
Tab.Type = "Custom"
Tab.AnchorTabItem.AnchorTab.XOffset = 0
Tab.AnchorTabItem.AnchorTab.YOffset = 0
Tab.AnchorTabItem.AnchorTab.IgnoreIfNotPresent = True
Tab.AnchorTabItem.AnchorTab.AnchorTabString = "AnchorString"
Tab.CustomTabWidth = 100
**Tab.CustomTabRequired = False**
Tab.CustomTabType = "Text"
Tab.TabLabel = "UniqueNameField"
Tab.TemplateRequired = False
Tab.SharedTab = True
Tab.RequireAll = False
I was able to make the text tab optional with these 2 lines of code:
Tab.CustomTabRequired = false;
Tab.CustomTabRequiredSpecified = true;
Please make sure you are referencing this WSDL: https://www.docusign.net/api/3.0/dsapi.asmx?wsdl
Using this sample code, I am trying to enable/disable the field "arrdatfrom". However, once this text field has been DISABLED, i cannot get it to be re-ENABLED. The function below gets executed when the user clicks a "Refresh" button. I have built this little demo just to prove that I have tried many ways to do this. Any ideas?
function showBooking() {
var d = new Date()
formvals.arrdatefrom = document.getElementById("arrdatfrom").value
formvals.arrdatethru = document.getElementById("arrdatthru").value
formvals.depdatefrom = document.getElementById("depdatfrom").value
formvals.depdatethru = document.getElementById("depdatthru").value
formvals.bookname = document.getElementById("bookname").value
formvals.peakroomfrom = document.getElementById("peakroomfrom").value
formvals.peakroomthru = document.getElementById("peakroomthru").value
formvals.peakattendfrom = document.getElementById("peakattendfrom").value
formvals.peakattendthru = document.getElementById("peakattendthru").value
alert (' ngs.hta ready to enable')
document.getElementById("arrdatfrom").enabled = 'true'
alert ('ngs.hta in showBooking!! disable. ')
document.getElementById("arrdatfrom").disabled = 'true'
...
There is no property .enabled. To re-enable a disabled element, set .disabled = false.
I've a SharePoint 2010 page with a list. The list has several items and a field named "Department" and must filter items based on user's department value retrieved from user profile.
To do this I've created a feature which upon activation adds UserContextFilterWebPart to the page and makes connection between UserContextFilterWebPart and XsltListViewWebPart. After the feature is activated I can see in the page design mode that connection is established but the list gets empty. Then I open web part's menu, choose "Connections" then "Send Filter Values To" and click "List1". When dialog appears I do nothing but only click "Finish" button and it begins to work fine. Can anybody please explain me why the connection begins to work only if I do that manual extra action? What must be done to fix?
I tried different way when List.Views[0].Query property is set to appropriate CAML query and it also works fine. But I'm told that it's not a good approach because of performance and parallel tasks issues. Is it really bad course of action?
Below is the code for 2 different approaches.
Thanks in advance!
1-s variant with UserContextFilterWebPart:
SPSite Site = new SPSite(URL);
SPWeb Web = Site.OpenWeb();
SPLimitedWebPartManager WPM = Web.GetLimitedWebPartManager(URL, PersonalizationScope.Shared);
XsltListViewWebPart List = WPM.WebParts[0] as XsltListViewWebPart;
UserContextFilterWebPart UCFWP = new UserContextFilterWebPart();
UCFWP.Title = "Current User Filter";
UCFWP.AllowEdit = true;
UCFWP.FilterName = "Current User";
UCFWP.SendEmptyWhenNoValues = true;
UCFWP.AllowClose = true;
UCFWP.ExportMode = WebPartExportMode.All;
UCFWP.AllowConnect = true;
UCFWP.AllowHide = true;
UCFWP.ProfilePropertyName = "Department";
UCFWP.ValueKind = UserContextFilterValueKind.ProfileValue;
UCFWP.ZoneID = "Main";
WPM.AddWebPart(UCFWP, UCFWP.ZoneID, 1);
WPM.SaveChanges(UCFWP);
ConsumerConnectionPointCollection consumerConnections = WPM.GetConsumerConnectionPoints(List);
ConsumerConnectionPoint addConsumerConnPoint = consumerConnections["DFWP Filter Consumer ID"];
ProviderConnectionPointCollection providerConnections = WPM.GetProviderConnectionPoints(UCFWP);
ProviderConnectionPoint addProviderConnPoint = providerConnections["ITransformableFilterValues"];
TransformableFilterValuesToParametersTransformer trans = new TransformableFilterValuesToParametersTransformer();
trans.ConsumerFieldNames = new string[] { "Department" };
trans.ProviderFieldNames = new string[] { "Department" };
SPWebPartConnection newConnection = WPM.SPConnectWebParts(UCFWP, addProviderConnPoint, List, addConsumerConnPoint, trans);
WPM.SPWebPartConnections.Add(newConnection);
2-nd variant with CAML query (intended to be used not in a feature but in a web part):
SPSite Site = new SPSite(URL);
SPWeb Web = Site.OpenWeb();
SPLimitedWebPartManager WPM = Web.GetLimitedWebPartManager(URL, PersonalizationScope.Shared);
XsltListViewWebPart List = WPM.WebParts[0] as XsltListViewWebPart;
SPUser CurrentUser = Web.CurrentUser;
SPServiceContext context = SPServiceContext.GetContext(Site);
UserProfileManager upm = new UserProfileManager(context, false);
UserProfile up = upm.GetUserProfile(CurrentUser.RawSid);
String UserDepartment = up["Department"].Value.ToString();
SPView ListView = Web.Lists["List1"].Views[0];
ListView.Query = "<Where><Eq><FieldRef Name='Department' /><Value Type='Text'>" + UserDepartment + "</Value></Eq></Where>";
ListView.Update();
I had a similar problem of connecting two web parts. I found the answer here: http://kvdlinden.blogspot.dk/2011/02/programmatically-connect-two.html
Note that that post describes how to do it with two XsltListViewWebParts. In order to use it in your case I suggest that you:
Create the connection manually,
Use PowerShell to get a SPLimitedWebPartManager for the page,
Use the manager to iterate through the manager.SPWebPartConnections,
And find the ProviderConnectionPointID for your connection,
Use that ID in the code shown in the post.
Also remember to setup the transformer - you can find this also from the SPWebPartConnections.
Next time you activate your feature you should have a connection equal to the one you made by hand.