Issue with SBOS ACCELERATORS module - sitecore

in my sitecore instance i install SOLS ACCELERATORS Module,
when I verify my showconfig in /admin/showconfig.aspx
i found this error message
error on line 2383 at column 612: Extra happy at the end of the document
in app_config/include/Sitecore.SBOSAccelerators.config
I removed the following line
<pageextenders>
       <pageextender type="Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender, Sitecore.SbosAccelerators" />
     </ pageextenders>
the showconfig.aspx works well
I tried to analyze the code of InsertAnalyticsDataExtender, but I found nothing until now,
someone already has this kind of problem?
thank you

ok that's fixed,
the author of SOLS ACCELERATORS Module, verify if the context of the current Site is not Shell or Sheel_Module beffor adding a hidden field with this ID "SC_ANALYTICS_PAGE"
but what happen if the contentType of the page is an XML or a json for example
in this case i'm going to have an error,
to fixe this issue just create a new class in your solution, inherite from
Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender
add this methode to your class
public override void Insert()
{
// you can replace Context.Site.Name by Context.Page.Page.Response.ContextType=="Text/Xml"
if (Context.Site.Name == "admin")
return;
base.Insert();
}
after that go to Sitecore.SBOSAccelerators.Config and change your pageextender to use the new class
happy conding

If you pasted the part of the configuration directly from your config file, you have a type in the config. You cannot close any tag with whitespace at the beginning of the closing tags like this </ pageextenders>. Try without the space </pageextenders>:
<pageextenders>
<pageextender type="Sitecore.SbosAccelerators.Shared.PageExtenders.InsertAnalyticsDataExtender, Sitecore.SbosAccelerators" />
</pageextenders>

Related

create an order on Prestashop API : error with module name

I'm trying to create an order through the Prestashop API (v1.6.1.13). I havn't written any module, my goal is just to use its API without installing anything on the prestashop.
Creating an order requires a module name. If I leave it blank I get the error:
Validation error: "Property Order->module is empty"
If I write a fake name it says :
Validation error: "Property Order->module is not valid"
What should I do ? While I have the same issue with the payment field ?
Here is what I'm sending :
<prestashop>
<order>
<id_address_delivery>1299</id_address_delivery>
<id_address_invoice>1300</id_address_invoice>
<id_cart>218</id_cart>
<id_currency>1</id_currency>
<id_lang>2</id_lang>
<id_customer>214</id_customer>
<id_carrier>2</id_carrier>
<current_state>2</current_state>
<module></module>
<invoice_number>0</invoice_number>
<delivery_number>0</delivery_number>
<valid>1</valid>
<date_add>2017-06-27 23:00:46</date_add>
<date_upd>2017-06-28 11:50:13</date_upd>
<id_shop_group>1</id_shop_group>
<id_shop>1</id_shop
<payment>MyPayment</payment>
<recyclable>0</recyclable>
<gift>0</gift>
<mobile_theme>0</mobile_theme>
<total_discounts>0</total_discounts>
<total_discounts_tax_incl>0</total_discounts_tax_incl>
<total_discounts_tax_excl>0</total_discounts_tax_excl>
<total_paid>27</total_paid>
<total_paid_tax_incl>27</total_paid_tax_incl>
<total_paid_tax_excl>27</total_paid_tax_excl>
<total_paid_real>27</total_paid_real>
<total_products>27</total_products>
<total_products_wt>27</total_products_wt>
<total_shipping>0</total_shipping>
<total_shipping_tax_incl>0</total_shipping_tax_incl>
<total_shipping_tax_excl>0</total_shipping_tax_excl>
<carrier_tax_rate>0</carrier_tax_rate>
<total_wrapping>0</total_wrapping>
<total_wrapping_tax_incl>0</total_wrapping_tax_incl>
<total_wrapping_tax_excl>0</total_wrapping_tax_excl>
<conversion_rate>1</conversion_rate>
<reference>170627369</reference>
<associations>
<order_rows>
<order_row>
<product_id>2</product_id>
<product_attribute_id>7</product_attribute_id>
<product_quantity>2</product_quantity>
<product_name>Blouse</product_name>
<product_reference>demo_2</product_reference>
<product_ean13>0</product_ean13>
<product_price>27</product_price>
<unit_price_tax_incl>27</unit_price_tax_incl>
<unit_price_tax_excl>27</unit_price_tax_excl>
</order_row>
</order_rows>
</associations>
</order>
</prestashop>
Any help/idea would be greatly appreciate, thanks !
After some debug steps in the payment module I found the solution.
The module should be a valid module name (I use "bankwire") and payment can be wathever you want (the name of the external source for example).
I was testing an address which country was disabled... Enabling the country fix the issue.
What a pity Prestashop doesn't respond the reason on the API call... Even if activating the DEV mode of prestashop and DEBUG of the PaymentModule.
Thanks for your help sarcom !
You need Enable the payment options(like payment by check) in prestashop admin side and then need to add the module with prefix ps_moduleName without any space.
I did like this,
$xml->order->module= "ps_".strtolower(str_replace(' ', '', $order_data['payment_method']));
You can try this if there is any error or If you have any better solution then it me know.
Thanks.

Extending the RenderField.GetFieldValue processor - not all items associated with the page are processed

I have a rich text field that has certain tokens ({{alt}} and {{title}}) for embedded images in the HTML. I extended the Sitecore.Pipelines.RenderField.GetFieldValue processor so that when a page is rendered on the front end, the processor will replace those tokens with the alt and title field values from the media item. Unfortunately my custom processor only processes a certain set of items (specifically WFFM fields), it does not process my Body field which has the tokens, even though I know the page I am browsing is rendering that field (the code run on the layout is #Html.Sitecore().Field("Body") which means it should get processed by the pipeline, correct?)
I also tried the GetTextFieldValue and GetMemoFieldValue processors but the same items were processed. Looking for some guidance as to specifically which fields are supposed to get processed by this pipeline.
Here is my Process() function:
public void Process(RenderFieldArgs args)
{
Assert.ArgumentNotNull(args, "args");
Assert.ArgumentNotNull(args.Item, "args.Item");
Assert.ArgumentNotNull(args.GetField(), "args.GetField()");
if (args.Item.Database == Database.GetDatabase("web"))
{
if (args.GetField().Value.Contains("{{alt}}"))
{
args.GetField().Value = ReplaceAltToken(args.GetField().Value);
}
if (args.GetField().Value.Contains("{{title}}"))
{
args.GetField().Value = ReplaceTitleToken(args.GetField().Value);
}
if (args.GetField().Name == "Body")
{
// Since we're rendering the body field differently we need to expand dynamic links
args.Item.Editing.BeginEdit();
args.GetField().Value = Sitecore.Links.LinkManager.ExpandDynamicLinks(args.GetField().Value);
args.Item.Editing.EndEdit();
}
}
}
My config include file:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<renderField>
<processor
type="[Redacted].Processor.RenderField.GetFieldValueExtended, [Redacted].Processor"
patch:after="processor[#type='Sitecore.Pipelines.RenderField.GetFieldValue, Sitecore.Kernel']" />
</renderField>
</pipelines>
</sitecore>
There were multiple steps to resolving this issue. Unchecking Cacheable on all renderings was an important first step. The rest of the issues I encountered were most likely specific to my solution (not well designed and will be refactored soon).
My local site did not have the most up to date files. When I updated the files, I still ran into the Attempt to retrieve context object of type 'Sitecore.Mvc.Presentation.PageContext' from empty stack error, which I was able to workaround by calling Sitecore.Web.UI.WebControls.FieldRenderer.Render(item, "Body") in a simple GetBody() function in the model, instead of Html.Sitecore().Field("Body"). Then in the view I simply put #Html.Raw(Model.Body).
I think the .Field() helper did not work because the item associated with the field requested was unknown, so yet another workaround is using Html.Sitecore().Field("Body", item) which specifies the item directly in the parameters.

DocuSign / Salesforce integration - tags not appearing with template

I have a custom button in SalesForce to use the "One Click Option" Send Now feature. The button also specifies to use a template with tags already in it.
If I login to DocuSign and preview the document as the signer would see it, I can see the tags.
However, when I send a request from SalesForce using the Send Now feature, the tags are not visible when the signer views the documents. I know that the sender can tag the fields in SalesForce, but that seems to defeat the purpose of having a template with the tags already present.
Does anyone have a solution for this?
Here is the custom button code below:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//
// One Click Option (default edit envelope screen)
OCO = 'Send'; //Ex: Tag
CRL = 'Email~{!New_Hire_Checklist__c.Correspondence_Email__c};FirstName~{!New_Hire_Checklist__c.First_Name__c};LastName~{!New_Hire_Checklist__c.Last_Name__c};Role~Applicant'
DST = '6005ADE1-54B2-4215-B060-C15E5821A695'
//********* Page Callout (Do not modify) *********//
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!New_Hire_Checklist__c.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
I think I see the problem, lines 9 and 10 of your code are missing ending semi-colons ;. Try changing to this:
CRL = 'Email~{!New_Hire_Checklist__c.Correspondence_Email__c};FirstName~{!New_Hire_Checklist__c.First_Name__c};LastName~{!New_Hire_Checklist__c.Last_Name__c};Role~Applicant';
DST = '6005ADE1-54B2-4215-B060-C15E5821A695';
Notice the semi-colons added at the end of each line.

Sitecore Multisite Manager and 'source' field in template builder

Is there any way to parametise the Datasource for the 'source' field in the Template Builder?
We have a multisite setup. As part of this it would save a lot of time and irritation if we could point our Droptrees and Treelists point at the appropriate locations rather than common parents.
For instance:
Content
--Site1
--Data
--Site2
--Data
Instead of having to point our site at the root Content folder I want to point it at the individual data folders, so I want to do something like:
DataSource=/sitecore/content/$sitename/Data
I can't find any articles on this. Is it something that's possible?
Not by default, but you can use this technique to code your datasources:
http://newguid.net/sitecore/2013/coded-field-datasources-in-sitecore/
You could possibly use relative paths if it fits with the rest of your site structure. It could be as simple as:
./Data
But if the fields are on random items all over the tree, that might not be helpul.
Otherwise try looking at:
How to use sitecore query in datasource location? (dynamic datasouce)
You might want to look at using a Querable Datasource Location and plugging into the getRenderingDatasource pipeline.
It's really going to depend on your use cases. The thing I like about this solution is there is no need to create a whole bunch of controls which effectively do he same thing as the default Sitecore ones, and you don't have to individually code up each datasource you require - just set the query you need to get the data. You can also just set the datasource query in the __standard values for the templates.
This is very similar to Holger's suggestion, I just think this code is neater :)
Since Sitecore 7 requires VS 2012 and our company isn't going to upgrade any time soon I was forced to find a Sitecore 6 solution to this.
Drawing on this article and this one I came up with this solution.
public class SCWTreeList : TreeList
{
protected override void OnLoad(EventArgs e)
{
if (!String.IsNullOrEmpty(Source))
this.Source = SourceQuery.Resolve(SContext.ContentDatabase.Items[ItemID], Source);
base.OnLoad(e);
}
}
This creates a custom TreeList control and passes it's Source field through to a class to handle it. All that class needs to do is resolve anything you have in the Source field into a sitecore query path which can then be reassigned to the source field. This will then go on to be handled by Sitecore's own query engine.
So for our multi-site solution it enabled paths such as this:
{A588F1CE-3BB7-46FA-AFF1-3918E8925E09}/$sitename
To resolve to paths such as this:
/sitecore/medialibrary/Product Images/Site2
Our controls will then only show items for the correct site.
This is the method that handles resolving the GUIDs and tokens:
public static string Resolve(Item item, string query)
{
// Resolve tokens
if (query.Contains("$"))
{
MatchCollection matches = Regex.Matches(query, "\\$[a-z]+");
foreach (Match match in matches)
query = query.Replace(match.Value, ResolveToken(item, match.Value));
}
// Resolve GUIDs.
MatchCollection guidMatches = Regex.Matches(query, "^{[a-zA-Z0-9-]+}");
foreach (Match match in guidMatches)
{
Guid guid = Guid.Parse(match.Value);
Item queryItem = SContext.ContentDatabase.GetItem(new ID(guid));
if (item != null)
query = query.Replace(match.Value, queryItem.Paths.FullPath);
}
return query;
}
Token handling below, as you can see it requires that any item using the $siteref token is inside an Site Folder item that we created. That allows us to use a field which contains the name that all of our multi-site content folders must follow - Site Reference. As long at that naming convention is obeyed it allows us to reference folders within the media library or any other shared content within Sitecore.
static string ResolveToken(Item root, string token)
{
switch (token)
{
case "$siteref":
string sRef = string.Empty;
Item siteFolder = root.Axes.GetAncestors().First(x => x.TemplateID.Guid == TemplateKeys.CMS.SiteFolder);
if (siteFolder != null)
sRef = siteFolder.Fields["Site Reference"].Value;
return sRef;
}
throw new Exception("Token '" + token + "' is not recognised. Please disable wishful thinking and try again.");
}
So far this works for TreeLists, DropTrees and DropLists. It would be nice to get it working with DropLinks but this method does not seem to work.
This feels like scratching the surface, I'm sure there's a lot more you could do with this approach.

Why is php_template_preprocess_page function not called in Drupal 6x?

From another forum I found the following example:
"I was looking for a way to pull node data via ajax and came up with the following solution for Drupal 6. After implementing the changes below, if you add ajax=1 in the URL (e.g. mysite.com/node/1?ajax=1), you'll get just the content and no page layout.
in the template.php file for your theme:
function phptemplate_preprocess_page(&$vars) {
if ( isset($_GET['ajax']) && $_GET['ajax'] == 1 ) {
$vars['template_file'] = 'page-ajax';
}
}
then create page-ajax.tpl.php in your theme directory with this content:
<?php print $content; ?>
"
This seems like the logical way to do it and I did this, but the phptemplate_preprocess_page function is never called ... any suggestions?
I figured it out for myself from a Drupal Support Theme Development page:
"Maybe this helps
leahcim.2707 - May 29, 2008 - 05:40
I was trying to get the same thing done and for me this works, but I'm not sure if it is the correct way as I'm still new to Drupal:
in "template.php" I added the following function:
function phptemplate_preprocess_page(&$vars)
{
$css = $vars['css'];
unset($css['all']['module']['modules/system/system.css']);
unset($css['all']['module']['modules/system/defaults.css']);
$vars['styles'] = drupal_get_css($css);
}
I think after adding the function you need to go to /admin/build/themes so that Drupal recognises the function."
The part in bold is what did the trick ... you have to re-save the configuration so it recognizes that you've added a new function to the template.