Orchard CMS Editable Content on MVC Views - orchardcms

I'm working on an Orchard module for selling an e-book of sorts. Prior to purchase, a user can view a page showing a sample of the product. After purchase, there is no more need for the sample page, and the user has access to the full product.
I would like to set things up such that if a paying customer tries to access the sample page that they would be redirected to their full product and if a non-customer were to try to go to full product page they would be redirected to the sample. I'd also like my page content to be editable via the Dashboard.
My current implementation:
Controller handling the conditional routing / redirecting based on whether a purchase has been made.
A layer rule for each of my page url's each containing an html widget to provide the page content
This seems to work, but I am wondering what other options I have to accomplish this.

You may be making things way more complicated than they need to be.
Using widgets is unnecessary. It would be much better to build a regular content type and display that. You could serve it through a special controller that checks for a purchase, but even that is unnecessary. Instead, you could create a part that would have the purchase verification logic in its driver's display method. This way, you could even apply the exact same logic to any content type.

Related

What page should json-ld for LocalBusiness be put on? [duplicate]

I'd like to place a Schema.org Organization item on my website.
Should I place the JSON-LD only on the contact page or can I add it to every page of the website? What is the best solution?
With Schema.org, you would typically provide structured data about what is relevant to the current page.
Assuming that it’s the website of the organization, you could specify your Organization as value for these properties:
publisher
(for WebSite, for every WebPage)
about and mainEntity
(for WebSite, for the WebPage on the homepage, for the AboutPage)
author
(for Article, BlogPosting etc.)
(There are more properties, of course. Simply check the type pages for properties that have Organization, or the parent type Thing, as "Expected Type".)
Note that you don’t have to repeat the data, you could simply refer to it instead. Then it would make sense to provide the full data on the page that is given as url of the Organization, so typically the homepage.
According to Google, Organization Schema should be on only 1 page of a website (usually the homepage of contact page).
Source: https://www.searchenginejournal.com/google-do-not-put-organization-schema-markup-on-every-page/289981/

Detect internal order/created in administration

We have built a custom payment provider, see http://pmc.digital/pt/blogue/junho-2016/integracao-mb-way-com-kentico-cms/ (PT only sorry, see https://translate.google.com/translate?hl=en&sl=pt&tl=en&u=http%3A%2F%2Fpmc.digital%2Fpt%2Fblogue%2Fjunho-2016%2Fintegracao-mb-way-com-kentico-cms%2F for Google Translated version).
It works great, including with internal orders by site editors, however because the visitor (on the front-end) needs to be redirected to a "Pending Order Page" (with instructions to accept the payment in the provider's APP), it is also redirecting users in admin.
I was hoping to have a ViewMode for the administration, however when doing an internal order the PortalContext.ViewMode is live site (I guess so it can use the Shopping Cart steps/methods, etc).
Is it enough to check whether the current logged in user is not the user for the cart, and has the necessary permissions to the ecommerce module?
Considering usability what's the best method to redirect to the Orders APP from the CMSPaymentGatewayProvider ProcessPayment method?
You can use the following as well:
if(!string.IsNullOrEmpty(DocumentContext.CurrentAliasPath))
{
//do front end code
}
else
{
//do back end code
}
I have this running in a custom payment gateway with no issues at all.
The page that is used for creating new orders via administration interface has following url:
/CMSModules/Ecommerce/Pages/Tools/Orders/Order_New.aspx
So you can either check if the order is placing through this page or you can customize it and set some custom variable that would tell where you are placing the order.
If you want to get redirected to man Orders application, then the url is:
/Admin/CMSAdministration.aspx#b72ad042-31bf-4ff2-8436-25a647bba548
If you want just the grid of orders, then this is the url you are looking for:
/CMSModules/Ecommerce/Pages/Tools/Orders/Order_List.aspx

Create a web page in Orchard

I need to create a "custom" web page in Orchard. As I understand it, below are the steps I need to take to do so. Before I go down this somewhat lengthy process, are there any steps I'm missing or that I can skip?
Create a model
Create a content part and content part record which use the above model
Create a driver which implements the Display method which returns the "shape" of the content part
Create a shape template to render the shape returned from the above driver
Create a content type which holds the content part
Create a page which holds the content type
Add the page to my site
This page is "custom", in the sense that it needs to pull data from a web service and display it in an interactive way. When the user makes changes, those changes will need to be sent back to the web service.
Those are really steps for creating a content item. You would want to create a content item if your page should be treated as content - e.g. administrators can create, edit, publish, unpublish, and finally delete your page.
If you just want to create a simple page, then there is nothing to stop you from creating your own ASP MVC controller. You can define routes for it using Orchard's routing, and if you decorate it with a [Themed] attribute, it will even inherit the site's theme.

Email view that does not show buttons and views of other activities

I want to add Emails to navigation so It can be used like any other entity. Editing sitemap is not a problem but it does not work in the expected way.
First, of all it shows all entities, not emails only. And consequently there are filters for other activities which are unwanted.
How do I make email-view that does not show other activities?
Create a new view in CRM showing the records you wish to see
Create a HTML web resource, with an iFrame pointing to the URL of the view you just created. It will look something like this /advancedfind/advfind.aspx?AutoRun=true&QueryId=%7b495B7974-58AC-E234-92D4-EE155D107003%7d&ViewType=4230&etn=email
Point your sitemap to the new web resource

Sharepoint Redirecting Users or Groups from a page to another

What I am tring to do is, when people comes to that page:
http://server:26521/MY_Portal/service/default.aspx
I want them to be redirected to that page
http://server:26521/default.aspx
Depending on their User name Or User Group.
Thanks for helps.
I can think of two ways to do this:
If you're using ISA Server or a similiar product in front of Sharepoint, you can configure it to do this. So those users who you want redirected will never access the first page.
Alternatively, you could write a webpart, which analyzes who the user is, and does some sort of redirection, either in .net or in javascript to the page you want.

Resources