-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
if (!defined('PIPIT_CATALOG_VERSION')) define('PIPIT_CATALOG_VERSION', '1.2.1'); | ||
if (!defined('PIPIT_CATALOG_VERSION')) define('PIPIT_CATALOG_VERSION', '1.3'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var pageUrl = window.location.href; | ||
|
||
|
||
if(pageUrl.includes('apps/perch_shop_products/product/edit')) { | ||
var url = new URL(window.location.href); | ||
var id = url.searchParams.get("id"); | ||
|
||
|
||
// add button | ||
var smartbar = document.querySelector('.smartbar ul'); | ||
var previewUrl = Perch.path+'/addons/apps/pipit_catalog/product_view.php?id='+id; | ||
|
||
let html = `<li class="smartbar-end smartbar-util"> | ||
<a href="${previewUrl}" title="View" class="viewext" target="_blank" rel="noopener"> | ||
<svg role="img" width="14" height="14" class="icon icon-o-world" title="View Page" aria-label="View Page"> <use xlink:href="/perch/core/assets/svg/core.svg#o-world"></use> </svg> | ||
<span>View</span> | ||
</a> | ||
</li>` | ||
|
||
smartbar.insertAdjacentHTML('beforeend', html); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
include(__DIR__.'/../../../core/inc/api.php'); | ||
|
||
|
||
$API = new PerchAPI(1.0, 'pipit_catalog'); | ||
$HTML = $API->get('HTML'); | ||
$Settings = $API->get('Settings'); | ||
|
||
|
||
$ShopAPI = new PerchAPI(1, 'perch_shop'); | ||
$Products = new PerchShop_Products($ShopAPI); | ||
$Settings = $API->get('Settings'); | ||
|
||
|
||
$Collection = false; | ||
|
||
$item_id = $product_url = false; | ||
|
||
// Find the collection | ||
|
||
if (isset($_GET['id']) && is_numeric($_GET['id'])) { | ||
|
||
$id = (int) $_GET['id']; | ||
$Product = $Products->find($id); | ||
|
||
$product_url = $Settings->get('perch_shop_product_url')->val(); | ||
|
||
|
||
$product_url = preg_replace_callback('/{([A-Za-z0-9_\-]+)}/', '_replace_vars', $product_url); | ||
|
||
|
||
$view_page_url = rtrim($Settings->get('siteURL')->val(), '/').$product_url; | ||
if($Product->status() == '1') { | ||
PerchSystem::redirect($view_page_url); | ||
} | ||
} | ||
|
||
|
||
function _replace_vars($matches) | ||
{ | ||
global $Product; | ||
|
||
if($matches) { | ||
$value = $matches[1]; | ||
return $Product->$value(); | ||
} | ||
|
||
} | ||
|
||
include(PERCH_CORE . '/inc/top.php'); | ||
if($Product->status() != '1') { | ||
echo $HTML->warning_block('Product Inactive', 'The product status is set to inactive. Inactive products cannot be viewed on the site.'); | ||
} else { | ||
echo $HTML->warning_block('Opps', 'The product URL is not set, or the product could not be found.'); | ||
} | ||
include(PERCH_CORE . '/inc/btm.php'); |