VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: sandomatyas on January 29, 2022, 07:06:17 AM

Title: Frontend link from admin product list view
Post by: sandomatyas on January 29, 2022, 07:06:17 AM
It would be nice having a frontend link from the admin product list view. Even more nice if it could be SEF url. Now we only have this from the product edit page.
A small .vm2-modallink icon or just link on the sku
Thanks a lot
Title: Re: Frontend link from admin product list view
Post by: pinochico on January 29, 2022, 08:09:01 AM
I don't need it, but if:
You can find link to product in file - administrator/components/com_virtuemart/views/product/view.html.php
then you can use it and add to table in file administrator/components/com_virtuemart/views/product/tmpl/default.php

Something as:


$menuItemID = shopFunctionsF::getMenuItemId(vmLanguage::getLanguage()->getTag());
$canonLink='';
if($product->canonCatId) $canonLink = '&virtuemart_category_id='.$product->canonCatId;
$product->product_sku_link = '<a href="'.juri::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.$canonLink.'&Itemid='. $menuItemID .'" target="_blank" >'. $product->product_sku .'<span class="vm2-modallink"></span></a>';


and the next


<?php 
//echo $product->product_sku;
echo $product->product_sku_link;
?>



and next time, have you ever tried to hire a developer or learn it yourself?

Edit:

You can tune and show link only for published product:


<td>
<?php 
if ($product->published != 0) {
echo $product->product_sku;
echo '<span class="pull-right">' $product->product_sku_link '</span>';
} else {
echo $product->product_sku;
}
?>

</td>
Title: Re: Frontend link from admin product list view
Post by: sandomatyas on January 30, 2022, 09:27:04 AM
I can do it myself without any problem, I've already written several extensions for VirtueMart, also sent few patches before.
The problem is it's not update-proof. If I modify the view.html.php and update VM it will override the file. If I create a template-override for the layout I won't gain the benefits of the new updates. So I've created a system plugin which adds it via JavaScript and ajax.
But I don't understand the tone. I think feature suggestions should be helpful for the community because the core component would be better and better, don't you think? :) Or is there better place to suggest new features?
Title: Re: Frontend link from admin product list view
Post by: pinochico on January 30, 2022, 11:24:20 AM
QuoteOr is there better place to suggest new features?

Yes, I think special section for contact DEV team
Title: Re: Frontend link from admin product list view
Post by: sandomatyas on January 31, 2022, 14:09:17 PM
Thanks, I'll check next time :)