How to create a confirm popup when delete item with field collection?

I have configured a field collection field (unlimited items) for a content type and I want create a confirm popup when user delete an item. For this, i found that i can directly go and modify 2 functions in the field_collection.pages.inc file. They are:

1. field_collection_item_delete_confirm

2. field_collection_item_delete_confirm_submit

I’m a newbie in drupal so I don’t know how to use these function from the field_collection.pages.inc file, I tried to hook these function in template.tpl file but it’s didn’t work. Can someone help me ? Sorry about my English.

Create List Item in Another Site Collection Using REST API from Visual Studio Workflow

I have developed a List Workflow in Visual Studio 2013.

In this, I am trying to read the current item’s Title and create an item in another list in another site collection.

Please read the last part clearly. I have to create an item in a list in a different site collection. But, both the site collections have the same user with contribute permissions. Since I have to create a list item in another site collection, I have no option than to use REST API to create a list Item. But to create a list item using REST API, I need to post a request to http://{siteName}/_api/web/lists/getbytitle('listTitle')/items URL and post the type, Title and other columns and X-RequestDisgest attributes in the payload. I am not sure, how to get the X-RequestDigest in my workflow.

If I skip this digest, I get an unauthorized exception upon checking it in Fiddler. Can anyone please help?

How to get related product collection in block

I use this way to get collection

/**  * Prepare and return product collection  *  * @return \Magento\Catalog\Model\ResourceModel\Product\Collection  */ public function createCollection() {     /** @var $  collection \Magento\Catalog\Model\ResourceModel\Product\Collection */     $  myBlock = \Magento\Framework\App\ObjectManager::getInstance()->get('AntonStudio\StockUpdate\Block\RelatedProducts');      $  currentProduct = $  myBlock->getCurrentProduct();     $  relatedProducts = $  currentProduct->getRelatedProductCollection();     /**      * Prevent retrieval of duplicate records. This may occur when multiselect product attribute matches      * several allowed values from condition simultaneously      */     $  relatedProducts->distinct(true);      return $  relatedProducts; } 

and used it in template

<?php if ( $  exist = ( $  block->getProductCollection() && $  block->getProductCollection()->getSize() ) ): ?>     <?php     $  type = 'widget-product-grid';      $  mode = 'grid';      $  image = 'new_products_content_widget_grid';     $  items = $  block->getProductCollection()->getItems();      $  showWishlist = true;     $  showCompare  = true;     $  showCart     = true;     $  templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::DEFAULT_VIEW;     $  description  = false;      $  objectManager = \Magento\Framework\App\ObjectManager::getInstance();      $  _helper      = $  this->helper( 'Magento\Catalog\Helper\Output' );     $  _imagehelper = $  this->helper( 'Magento\Catalog\Helper\Image' );     ?>      <div class="block widget block-products-list <?= /* @noEscape */     $  mode ?>">         <?php if ( $  block->getTitle() ): ?>             <div class="block-title">                 <strong><?= $  block->escapeHtml( __( $  block->getTitle() ) ) ?></strong>             </div>         <?php endif ?>         <div class="block-content">             <?= /* @noEscape */             '<!-- ' . $  image . '-->' ?>             <div class="home-products-<?= /* @noEscape */             $  mode ?> <?= /* @noEscape */             $  mode ?>">                 <ol class="home-product-items <?= /* @noEscape */                 $  type ?>">                     <?php $  iterator = 1; ?>                     <?php foreach ( $  items as $  _item ): ?>                         <?php                         $  _product = $  objectManager->get( 'Magento\Catalog\Model\Product' )->load( $  _item->getId() );                         $  all_data = $  _product->getData();                          $  imageUrl = $  _imagehelper->init( $  _item, 'product_thumbnail_image' )->resize(300, 300)->getUrl();                         ?>                          <?= /* @noEscape */                     ( $  iterator ++ == 1 ) ? '<li class="product-item">' : '</li><li class="product-item">' ?>                          <div class="ProductListItem">                             <a href="<?= $  block->escapeUrl($  block->getProductUrl($  _item)) ?>" class="ProductListItem__imageWrap">                                 <img src="<?= $  imageUrl ?>"                                      class="ProductListItem__productImage">                             </a>                             <div class="ProductListItem__summaryWrap"> <!--                                <div class="ProductListItem__productSize">--><?//= isset($  all_data['tile_length_mm'])?$  all_data['tile_length_mm']:'' . ' * ' . isset($  all_data['tile_width_mm'])?$  all_data['tile_width_mm']:'' ?><!--</div>-->                                 <a href="<?= $  block->escapeUrl($  block->getProductUrl($  _item)) ?>" class="ProductListItem__productTitle">title<?= $  block->escapeHtml( $  _item->getName() ) ?></a>                             </div>                             <div class="ProductListItem__addToCartWrap">                                 <div class="ProductListItem__price">                                     <?= $  block->getProductPriceHtml( $  _item, $  type ) ?>/M2                                 </div>                                 <div class="ProductListItem__addToCartIcon">                                     <?php if ($  this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $  showWishlist): ?>                                         <a href="#"                                            data-post='<?= /* @noEscape */ $  block->getAddToWishlistParams($  _item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $  block->escapeHtmlAttr(__('Add to Wish List')) ?>">                                             <span><?= $  block->escapeHtml(__('Add to Wish List')) ?></span>                                         </a>                                     <?php endif; ?>                                 </div>                             </div>                         </div>                         <?= ( $  iterator == count( $  items ) + 1 ) ? '</li>' : '' ?>                     <?php endforeach ?>                 </ol>             </div>             <?= $  block->getPagerHtml() ?>         </div>     </div> <?php endif; ?> 

But “$ block->escapeHtml( $ _item->getName() )” out put null

PowerShell: Generate a report of all items across a site collection where a column has a specific value

I am trying to come up with a script to do the following in my SharePoint 2013 environment, and have not had much luck.

I need a script that will generate a report/csv that will give me the value of a site column when it has a specific value.

For example, say I have a site collection at http://test/site, and a site column named “State.” That column is used in multiple lists throughout my site collection. I need to generate a report which shows all instances of items where State Column = Texas.

Thanks for any help you can provide.

Set List Queue Deque Map these are Collection frameworks of Java but can anyone differentiate the unique features among each of them [on hold]

We are know Set List Deque Map Queue are all a part of java collection framework but can anyone please tell me how are the unique in terms of

  1. Memory management
  2. Fetching Data
  3. When is the particular data structure most appropriate
  4. Also drawbacks in why should we not use the particular data structure

magento 2.2 product repository interface returns no collection

I’m trying to get a product collection via ProductRepositoryInterface. The code I’m using is this:

$  searchCriteria = $  this->_searchCriteriaBuilder->create(); $  searchResults = $  this->_productRepository->getList($  searchCriteria); $  products = $  searchResults->getItems(); 

The count for $ products is correct (10) however I cannot reach the products inside the $ products variable. I tried with foreach $ product as $ key => $ value: the $ key is printed (I get all the ten keys) but the value is always empty.

How can I get the product attributes (sku, name, etc) from the collection?

Moving sppkg apps from site collection to site collection

I was tasked to move the existing apps from the parent site app catalog to the sub-site’s own app catalog. i tried downloading the packages from the parent site’s app catalog and uploading it to the sub site’s app catalog. but when i tried adding the apps to the sub site. i got an error of “Invalid App Id:xxxxx”.

How do i move the existing apps? is it possible to do what i just did?

Views Contextual Filter by taxonomy in field collection

I have a Drupal 7 project I’m working on that’s got me stumped.
I’m building a site where the node (Decals) are applicable to models and years (This decal is correct for this model of this year). Each product my be applicable multiple models and multiple years.

I created a content type that has a field collection of model and years that can have unlimited values. So far so good.

Where i’m stuck is i want to have a related decals block at the bottom, that would suggest additional decals based not the models and years that listed in the field collection.
I’ve creating a view of nodes that has a relationship to the field collection, but I can’t figure out how to limit the results to only the models & years associated to the node.

Any suggestions would be greatly appreciated.

Product Collection Only Getting the Main Website Products not All Store Products

I am using a basic product collection to get in-stock enabled product but it isn’t returning all in-stock enabled products in my store. Please find the code below:

$  Products =  Mage::getModel('catalog/product')->getCollection(); $  Products->addAttributeToSelect('*'); $  Products->addAttributeToFilter('status', 1); Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($  Products); echo count($  Products); 

Its showing the count of 1964 records which is present in main website but total it must show 2003 records which is present including all stores.

I tried with filter $ Products->addWebsiteFilter(array(1,2,3,4)); but still it returns the main website product count.

I tried this https://magento.stackexchange.com/questions/67893/product-collection-wont-get-all-productstoo, but not worked.

Also suggest some best query to fetch the collection,so that it not load the server.

Thanks