I wouldn't recommend this methodology since the images may be deleted quickly but the relation entity on the database involving all these images wouldn't be deleted as it would only take useless place in the SQL tables. The best option would be to replace all these images by another image which would rather confirm the specific orders has been processed and completed so for the merchant to have a better understanding between each orders.MarketInSG wrote:Access your website via FTP client. Browse to your image folder and delete from there. You can use filezilla if you don't know any FTP client to use.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Straightlight, I didn't know that images' information wouldn't delete from the SQL. It means ftp clients is a bad idea.
I tried to add this code to admin/controller/catalog/product.php
Code:
$query = $this->model_catalog_product->getProduct($product_id);
if (file_exists(DIR_IMAGE . $query->row['image'])) {
@unlink(DIR_IMAGE . $query->row['image']);
}
However this stuff didn't work corretly. Please maybe somebody can advise me how to add the code right?
Now, when stating didn't work correctly, could you be more specific ?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
$this->model_catalog_product->deleteProduct($product_id);
but it show an error when i delete a product.
Please my currently code is;
$this->load->model('catalog/product');
if (isset($this->request->post['selected']) && $this->validateDelete()) {
foreach ($this->request->post['selected'] as $product_id) {
$this->model_catalog_product->deleteProduct($product_id);
}
What do i have to add there? will it work if a sold product has a few images to delete?
What does the error message ?but it show an error when i delete a product.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
if (isset($this->request->post['selected']) && $this->validateDelete()) {
foreach ($this->request->post['selected'] as $product_id) {
$this->model_catalog_product->deleteProduct($product_id);
}
Code: Select all
if (isset($this->request->post['selected']) && $this->validateDelete()) {
foreach ($this->request->post['selected'] as $product_id) {
$this->model_catalog_product->deleteProduct($product_id);
}
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Notice: Trying to get property of non-object in /home/randttre/public_html/admin/controller/catalog/product.php on line 129Notice: Trying to get property of non-object in /home/randttre/public_html/admin/controller/catalog/product.php on line 130Warning: unlink(/home/randttre/public_html/image/) [function.unlink]: Is a directory in /home/randttre/public_html/admin/controller/catalog/product.php on line 130Warning: Cannot modify header information - headers already sent by (output started at /home/randttre/public_html/admin/index.php:72) in /home/randttre/public_html/system/engine/controller.php on line 27
the current code is;
$this->document->title = $this->language->get('heading_title');
$this->load->model('catalog/product');
if (isset($this->request->post['selected']) && $this->validateDelete()) {
foreach ($this->request->post['selected'] as $product_id) {
$query = $this->model_catalog_product->getProduct($product_id);
if (file_exists(DIR_IMAGE . $query->row['image'])) {
@unlink(DIR_IMAGE . $query->row['image']);
}
$this->model_catalog_product->deleteProduct($product_id);
}
As for this error message:
Code: Select all
Warning: unlink(/home/randttre/public_html/image/) [function.unlink]: Is a directory
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
find:
Code: Select all
public function deleteProduct($product_id) {
Code: Select all
$product_images = $this->getProductImages($product_id);
if ($product_images->num_rows) {
foreach ($product_images->rows as $product_image) {
if (file_exists(DIR_IMAGE . $product_image['image'])) {
@unlink(DIR_IMAGE . $product_image['image']);
}
}
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 25 guests