If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Zen Cart Code Suggestions / Unlink images on preview product cancel action

Unlink images on preview product cancel action

Started by mesnitu on 18 Jan 2019, 8:51 AM · Views: 54

Results 1 to 2 of 2
18 Jan 2019, 8:51 AM
#1
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Unlink images on preview product cancel action

zc156a
Hi
Right now, if you cancel a new product (on preview), after uploading a image, it doesn't delete the image.

Maybe something more subtle to hide that url get, maybe using a global (?), to catch that on category_listing and delete / unlink request.

<a href="<?php echo zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . 
(isset($_GET['search']) ? '&search=' . $_GET['search'] : '') . 
'&unlink_img='.$products_image_name.''); ?>" 
class="btn btn-default" role="button"><?php echo IMAGE_CANCEL; ?></a>

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

18 Jan 2019, 10:06 AM
#2
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Re: Unlink images on preview product cancel action

This unlink image on cancel, would also be made on update product cancel.
So 2 places:

new_product (empty post)
preview -> image is uploaded -> cancel -> delete image

Or
new_product (empty post)
preview -> image uploaded -> back button pressed
update-> cancel -> delete image

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison