Sitecore Page Editor Publishing items related to content - sitecore

I have a "Product Page",Product page maps to "ProductPage" Sitecore item. Website/Pages/ProductPage.
I have a text area in that page with page editor, which loads text from "Product Example Text" Sitecore item's "Description" text from Web database. (Sitecore.../CommonText/Product Example Text)
In my ascx file, mark up is pretty straigh forwad,
<sc:FieldRenderer ID="FieldRenderer1" runat="server" />
Codebehind,
FieldRenderer1.Item = //"Product Example Text" Sitecore item
FieldRenderer1.FieldName = "Description";
When I open the page in Page Editor(as a system admin), it allows me to change the "Product Example Text", and when I save using the "Save" button on the Page Editor it get saved to the master database. "Product Example Text" item get saved.
Now, when I try to publish the item using the "Publish" item in the Page Editor ribbon, these changes do not get reflected,reason is "Product Example Text" item does not get published.
When I save the page, somehow Sitecore understands the "Product Example Text" item has to be saved. But why does not it get published?
Am I doing anything wrong.... How can I solve this issue?

While saving an item in Page Editor, Sitecore saves all the field renderers which are displayed on the page, so if you set the Item property of a FieldRenderer1 to "Product Example Test" Sitecore Item, Page Editor know which item should be saved.
The problem with publishing is that you enqueue the current item in the publishing queue, but this item has no link to the "Product Example Test" Sitecore Item in any of its properties cause you're setting the Item property of the field renderer dynamically in the code.
The option would be to add another button to Page Editor next to Edit Related Item button and create a command that will Publish Related Item. The complete description how to add such a command can be found in the answer Sitecore page editor - how to extend page editor item editing panel

Another approach would be to create the "Product Example Test" content item under the "ProductPage" as a sub item. In publish options you can use publish sub items, which will publish all content you want.
But the problem is, if you want a particular content to be shared in several places, this won't work.
Maras's answer is a better solution.

Related

APEX - double click on interactive gird

Below is my interactive grid. It shows data from v$sql_monitor view based on sql_id from list .
What I would like to do is to create double-click dynamic action on a record. This action would open new modal dialog and pass two parameters : 1. sql_id from list above 2.sql_exec_id from clicked record. Would you give me a few hints how to do it ? I guess a piece of Javascript code will be necessary :(
There are multiple options to do this - here is one way, by using javascript custom events. I created a sample with an IG on the EMP/DEPT sample dataset with page 88 as IG and page 90 as modal. The column ENAME is a link to page 90 that sets a column value and a page item in the link.
Page 88 has an IG and 2 page items:
P88_PAGE_ITEM (a value entered on the page like the list in your screenshot)
P88_ENAME (to hold the selected report column value
Page 90 has 2 page items: P90_PAGE_ITEM and P90_REPORT_COLUMN
Create IG on page 90 on table EMP
On column ENAME, add the following under "JavaScript Initialization Code"
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '<button type="button" class="t-Button t-Button--link my-ename-js" data-ename="&ENAME.">&ENAME.</button>'
};
return config;
}
This is a button of type "display as link", created with the universal theme button builder that has 2 extra attributes: a class my-ename-js and a data attribute "ename" data-ename="&ENAME."
Create a dynamic action to capture the click and set the page item:
Make sure to set the scope to "Dynamic". This is needed because the event listener needs to be added again after a dom change (a search or filter of the IG).
add a true action of type "Set Value" to set the value of P88_ENAME to the value of the selected row
add a second true action to trigger a custom javascript event:
Create a dynamic action of type "Event: Custom" to capture the custom event triggered in the previous DA.
add a true action of type "Submit Page". Note that "Show Processing" needs to be unchecked.
Almost there. One last thing is to create a branch to the modal page:
Create a branch (process point "After Processing") with server-side condition of "Request = Value" with value OPENMODAL and link attributes below:
And this should be the result:
Well, I modified a bit your scenario.
I added new SelectList P88_FILTER
and added dynamic action ON_CHANGE :
with action
I modified source if IG:
These changes allowes me to filter IG . In our case filter returns always only one record like below.
and now my problem begins. In your scenario clicking the link "ename" updates field P88_ENAME and opens modal dialog with proper values. After my modification neither P88_ENAME updates nor modal dialog opens :(

Oracle Apex How to display page item as url

I have a page item which stores URL.
How do i change its type to URL so that the link becomes clickable.
As of now, there is page subtype url, but setting it doesn't make any difference.
Apex 21.1
A text field is an html input element, that will display text only, you probably could write some javascript to open whatever is in the page item in an url but that is confusing functionality. What should happen if the user clicks in the input element ? Should it open the link or should the user be editing the value ?
This is a possibility.
Create a page item on your page, say P1_URL
Add the following in the "Post Text" attribute of the page item (style it to your own preference):
<span class="fa fa-external-link" aria-hidden="true"></span>
Add a dynamic action on change of the element P1_URL with a true action of "Execute Javascript Code" and the following code:
$("#myurl").attr("href", apex.item( "P13_URL" ).getValue())
Check "Fire on Initialization" for the true action.
That is all there is to it, now when you add something in the page item P1_URL and click the link, it will open the that url in a new window.
UPDATE: Technique for read only text field.
For a read only text field, the input element is hidden and an additional span element is rendered with an the page item name as id, suffixed by _DISPLAY. The trick is to grab the content of that span element and add an anchor with attributes. This can be done with an onload dynamic action:
Create a page item on your page, say P1_URL, set it to "Read-Only: Always"
Add a dynamic action on Page Load with a true action of "Execute Javascript Code" and the following code:
let itemVal = $("#P1_URL_DISPLAY").text()
$("#PP1_URL_DISPLAY").html(`<a href='${itemVal}' target='_blank'>${itemVal}</a>`)
Make sure that when you copy this, the quotes are exactly the same: the outer quotes are backticks, those are needed for the ES6 syntax.
Note: check the page documentation for the subtype url - it explains exactly what it does.

How to set modal dialog title dynamically in oracle apex 18

I want to set modal dialog title dynamically based on an interactive element.
ex) In page 50, I've made an Interactive Grid and set the link on "Title" column, when user click on title column, a modal dialog appears.
I want to set the title of that modal dialog to title column's content.
But modal dialog's title doesn't change dynamically.
In this case, how can I apply the titles dynamically?
I've seen many solution related to this question, but I can't solve my problem.
Let's say, your model page number is 51. Here are step by step approach [TESTED] to dynamically change title of model page:
Create a hidden item in your model page, let's say the hidden item name is P51_Title.
In Interactive report -> title column link -> click on link builder box -> set values -> add Hidden item as P51_TITLE under Name and value as '#Title#' Column (#ColumnName#).
In model page 51 static region header (title property), add hidden item value as &P51_TITLE. (dot is mandatory to add at last. This is substitution string with & and dot(.) before and after of item name respectively)
save both the pages and run. when you will click on title column link, the link will be redirecting to the model page and title data will be passed through URL to hidden item in the session, so model page header will automatically change based on title data from report.
I made such dialogcreate js function.
It moves popup page Title to modal dialog title.
So, dynamic calculated title &P51_TITLE. would be applied automatically.
$(document).on("dialogcreate", ".ui-dialog--apex", function(e) {
var lDialog = $(this);
lDialog.find('iframe').on('load',function () {
lDialog.children(".ui-dialog-content")
.dialog("option", "title", $(this.contentDocument).find('title').html());
});
});
I am very disappointed that something like this (or any other solution) do not work in apex modal pages by default!

In Oracle APEX, how do I make my button delete a row?

In Oracle APEX, I figured out how to add a button into the APEX table. Here is my table so far, and the extra column has a link "Sample Link Text" .
It is by adding this code :
<button class="t-Button " id="#edit_link#"
onclick="showRow(#edit_link#);" type="button"><span class="t-Button-label"> + </span></button>
However, I'm stuck on the task of causing the button click to delete the current row. How do I link the button to an action (like delete or update)?
thanks
If you have a created that Apex table as a tabular form, I believe that there's a default delete button that comes with it but if there's none, here's how to create a delete button:
Under the region of your table, create a button. Then set it's "Action" property to "Redirect to URL". Set it's target URL to this javascript:apex.confirm(htmldb_delete_message,'MULTI_ROW_DELETE');
Then Save.
Also Please check if the Delete check box is selected in process.
Property Screen Shot

Magento:How to display drop down attribute on the product listing page

I have created a drop down attribute with a configurable product.
I would like to add in the grid/list product’s page the combo with the choice of my select attribute in order to be able to put in directly from this page the product into my cart wich is impossible for the moment : i have to go on the second page to choose the attribute.
i’ve read a lot of threads but i don’t find a way to achieve it.
thanks for the help.
So you want product "add to cart button" with "custom attributes" to be added to the product listing pages..there's an extension for this, see below:
http://www.mageworx.com/ajax-cart-magento-extension.html
I have only managed to add an "add all item to cart" button and "add to cart" button on my category listing pages.
For the attributes which have a frontend type “Select” we need to define options that on the product page converted into a dropdown. For example attribute color may have options Red, Green, Blue etc. which are defined in the admin area.
We can easily collect all the defined options for any attribute.
// use your own attribute code here
$attribute_code = "color";
$attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code);
$options = $attribute_details->getSource()->getAllOptions(false);
Foreach($options as $option){
// print_r($option) and find all the elements
echo $option["value"];
echo $option["label"];
}
For more information about magento cart products, visit our Web\Agency-shop