I am migrating my sitecore from sitecore 6.5 to 8.1 - sitecore

I am migrating a website using Sitecore 6.5 to sitecore 8.1
Below is the code written in sitecore 6.5, I need to change to sitecore 8.1 version.
when I used sitecore.analytics 8.1 version, it is showing error.
can some help in getting the issue resolved for the below code
public static int GetPageVisits(ID pageId)
{
return DataAdapterManager.Provider.Sql.ReadOne<int>(CommandText, ReadPageViews, new object[] { "currentItemId", pageId.ToString() });
}
below is the error I am getting...
Error 1 'Sitecore.Analytics.DataAccess.DataAdapterProvider' does not
contain a definition for 'Sql' and no extension method 'Sql' accepting
a first argument of type
'Sitecore.Analytics.DataAccess.DataAdapterProvider' could be found
(are you missing a using directive or an assembly reference?)

Sitecore Analytics API changed in xDB, From your code i can see you are trying to get page visits number, For that you can use the following API
VisitStatistics PageStats = Sitecore.Analytics.Testing.TestManager.GetPageStatistics(Guid, DateTime, DateTime)
Guid parameter is the item ID, the 2 DateTime parameters are for the interval time range you want to get the page statistics for.

Related

Facebook Graph API - Field attachments specified more than once. This is only possible before version 2.1

I'm using the FB Graph API explorer and version 11.0 I've added the page id, feed and fields. Previously we were using 'link' and 'title' but according to the docs here those are deprecated and these are the new field names:
attachments{unshimmed_url}
attachments{title}
but when I add this to the FB Graph API Explorer I either get the error:
Field attachments specified more than once. This is only possible
before version 2.1
or I only get the first mentioned attachments field (attachments{unshimmed_url})
1234567/feed?fields=attachments{unshimmed_url}&attachments{title}
Can’t reproduce this error right now, using v11.0, but it should work if you just list the sub-fields comma separated:
…/feed?fields=attachments{unshimmed_url,title}
https://developers.facebook.com/docs/graph-api/advanced#fieldexpansion
Edit: Can reproduce, with the “correct” incorrect syntax.
feed?fields=attachments{unshimmed_url},attachments{title} throws this error; you had feed?fields=attachments{unshimmed_url}&attachments{title} in your post, which is a different thing - that’s one URL parameter named fields, and then one named attachments{title}

ActiveModel::MissingAttributeError (can't write unknown attribute `price_cents`): error after rails upgrading to rail 5.1

I have upgraded my rails app which was earlier on rails 4.1 to rails 5.1.
Now I am getting an error while using acts_as_shopping_cart gem, which is on version 0.4.1
I tried many things but not sure why exactly I am getting this error, while adding item to cart
ActiveModel::MissingAttributeError (can't write unknown attribute price_cents):
app/models/shopping_cart.rb:11:in add
app/controllers/shopping_carts_controller.rb:38:in add_to_cart
Any suggestions on this, will be appreciated. Thanks in advance
this one is still not yet supported for Rails 5 https://github.com/crowdint/acts_as_shopping_cart, you could try this one https://github.com/dabit/acts_as_shopping_cart
Late reply, but I was banging my head on this one for too long so I thought this may help other people.
You're getting the MissingAttributeError because your shopping_carts table doesn't have a price_cents field. The previous version of acts_as_shopping_cart (~ 0.2.2) was setup to use a float field called price, and it did not use the money-rails gem. The newer versions (>= 0.4.0) use money-rails and an integer field called price_cents, then money-rails "automagically" creates a attribute called "price" that converts to/from the price_cents field.
You may be able to migrate your price field using one of their helpers:
https://github.com/RubyMoney/money-rails#migration-helpers

Can't save models to DynamoDB using Swift 4

I started a new project using XCode9 and Swift4. I copied the basic example code for saving models to DynamoDB but I keep getting the following error:
Amazon DynamoDB Save Error: Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=0 "(null)" UserInfo={__type=com.amazon.coral.validate#ValidationException, message=Supplied AttributeValue is empty, must contain exactly one of the supported datatypes}
My project only contains the example code provided and nothing else, how can I get my models to save?
The work-around until Swift 4 is supported properly is to put
#objcMembers
before the class declaration for your model class, as described in this bug report.
https://github.com/aws/aws-sdk-ios/issues/750
This fixed the issue for me without having to downgrade to Swift 3.
DynamoDB doesn't seem to support Swift4 yet. I downloaded the sample project provided by AWS (MySampleApp) and set the target's build settings Swift Language Version to Swift 4.0, made slight modifications so it would compile, and I got the same error.
Reducing the Swift Language Version to Swift 3.2 in both the sample app and my own project fixed the problem.

Sitecore 7.5 upgrade

I am upgrading Sitecore 7.2 to Sitecore 7.5 .
Everything went good, but when I have to convert data for analytics I see many errors passing. First I did it without WFFM parameters, which worked perfectly.
Then a restored my original database and executed the same command with the WFFM parameters.
Now is see hundreds of erros passing in my conversion tool:
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Forms.ConversionTool
at Sitecore.Forms.ConversionTool.ConversionPipeline.<Process>b__2(VisitsRow v)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at Sitecore.Forms.ConversionTool.ConversionPipeline.Process(VisitExtensionArgs args)
at ...
Anyone who has an idea what is causing this error?
I had the same error and raised a support issue with Sitecore. Their answer was that the documentation in the xDB Upgrade and Conversion Guide is wrong with regards to the data reader type.
The documentation says:
/wffmreadertype "Sitecore.Forms.ConversionTool.Reader.SqlServerReader, Sitecore.Forms.ConversionTool"
It should be:
/wffmreadertype Sitecore.Forms.ConversionTool.Reader.SqlServerReader

Sitecore 7.2 Update3 $name Issue

We are facing one issue in Sitecore 7.2 Update 3.
Sitecore.Context.Item is returning old version and that version is not available in web DB, so we are getting $name for all the fields. On page load $name is displaying, if I refresh the page then it works fine after 5 minutes again we are getting $name, let me know if any body face this issue.
This issue has been addressed since Sitecore CMS and DMS 7.2 rev.151021 (7.2 Update-5):
Obsolete item versions might be present in search indexes after publishing. This has been fixed. (440383)
See the release notes on SDN for more information about the changes.
Additionally, check the known issue article with a possible workaround:
https://kb.sitecore.net/articles/992608
We fixed the issue by making sure that sitecore was returning the latest version of the context. We found out that sitecore, for some reason, was looking for a version on the web DB, and this was not the latest version. So we applied this:
Before:
public virtual Item Item
{
get { return Context.Item; }
}
After:
public virtual Item Item
{
get { return Context.Item.Versions.GetLatestVersion(); }
}
Maby something with a language version.
put the language code in the URL to ensure that you do not change the language, or check the Sitecore language cookie.
Other thing to check, In IIS check the Application pool, Advanced Settings, Maximum Worker Processes set it to 1 to ensure there is only 1 worker which should give every time the same response.