AbanteCart Community
AbanteCart Development => Development Help Needed => Topic started by: maulik 1intl on August 05, 2019, 12:08:13 AM
-
Hello sir
Nice to use ababtecart :) :)
i need create a button in product page to view product next and preview button where can change image of product.You can see attach image.Also add subscription button where by default selected yes.
-
I need developer who can do that for me. Thanks
-
hi!
here is the code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
a {
text-decoration: none;
display: inline-block;
padding: 8px 16px;
}
a:hover {
background-color: #ddd;
color: black;
}
.previous {
background-color: #f1f1f1;
color: black;
}
.next {
background-color: #4CAF50;
color: white;
}
.round {
border-radius: 50%;
}
</style>
</head>
<body>
<h2>Previous and Next Buttons</h2>
<a href="#" class="previous">« Previous</a>
<a href="#" class="next">Next »</a>
<a href="#" class="previous round">‹</a>
<a href="#" class="next round">›</a>
</body>
</html>
you have to know where should be added exactly to make it work.
Note:
there is 2 kind of samples in the code, you should choose which one is more suitable for you website.
Regards
-
Thanks for replay but i need to create controller to fetch link for on product page.
I know all product id is display page product/category page.
but need that id also get in page product/product page where i can use id for next and preview button.
-
check out this extension
https://marketplace.abantecart.com/lightbox_html5
-
:) :) Thanks :) :) for replay but i need to change products not product images.
Url:- http://1intl.com/10111
Above page you can see product 10111-1,10111-2 and more
Now if i select product 10111-1
Url:- http://1intl.com/10111/10111-1
I gone above page hear i need next preview button on next button click it's show next product 10111-2 , 10111-3.
-
HI!
Tell me please, how you integrated the header banner TOP of the Website please??
Regards
-
i am use default template theme to change.
-
AbanteCart v1.2.13
-
i am use default template theme to change.
can you share screenshot of your layouts please ???
-
Thanks :)
You can see it my live website
http://1intl.com/category
-
Thanks :)
You can see it my live website
http://1intl.com/category
can you share the html code of this block please??
-
you need code of html code? :) :) :) :)
Or
You short out my problem ? :( >:( >:(
Or
help me to solve my problem?
Hear is code
<div class="carousel-inner">
<div class="item active">
<div class="carousel-content">
<div class="header-carousel-style1">
<p>Welcome to 1 International, inc.</p>
</div>
</div>
</div>
<div class="item">
<div class="carousel-content">
<div class="header-carousel-style1">
<p>Subscribe and Save 10% off your first Order.</p>
</div>
</div>
</div>
<div class="item">
<div class="carousel-content">
<div class="header-carousel-style1">
<p>Connect with us on Whatsapp and Email for latest Catalogues.</p>
</div>
</div>
</div>
:) :) :) :) :) :) :) :) :) :)
-
Thank you my friend :D I tried my best. I still learning however.
Regards
-
:) :) ok you need to put this code in file best of luck
storefront\view\default\template\common\header.tpl
-
So you want link to next product? as far as I can see this will load the whole page why not just change the image? like I suggested. But yes to do what you want you need to change some code. Also how would you determine next product? home->category->subcategory so all previous and next should be for sub-category ?
-
Thanks :)
Could you tell me which code change?
or create code for me i ready for pay to change or create code for me?
-
You will need to edit core code to get this. Better option is to make an extension
But try this if it works for you because I think you have some custom code already:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/product/product.php#L750
if(isset($category_info) && count($category_info) > 0){
$nextPrevProducts = $this->model_catalog_product->getProductNextPrevProducts($product_id, $category_info['category_id']);
$this->data['nextPrevProducts'] = $nextPrevProducts;
}
right above foreach ($results as $result) {
-----
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/catalog/product.php
Add this before last } line
public function getProductNextPrevProducts($productId, $categoryId){
$sql = "SELECT * FROM " . $this->db->table("products_to_categories") . " WHERE `category_id` = $categoryId and product_id in ( select product_id from " . $this->db->table("products") . " where STATUS = 1)";
$query = $this->db->query($sql);
$product_data = $query->rows;
$nextPrevProduct = array();
if(count($product_data) > 0){
foreach($product_data as $k => $v){
if($v['product_id'] == $productId){
$preProductId = isset($product_data[$k - 1]['product_id']) ? $product_data[$k - 1]['product_id'] : 0;
$nextProductId = isset($product_data[$k + 1]['product_id']) ? $product_data[$k + 1]['product_id'] : 0;
$cateSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'category_id=$categoryId'";
$cateSqlQuery = $this->db->query($cateSql);
$cateURL = count($cateSqlQuery->rows) > 0 ? $cateSqlQuery->row['keyword']: '';
$prevProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$preProductId'";
$prevProductSqlQuery = $this->db->query($prevProductSql);
$prevProductURL = count($prevProductSqlQuery->rows) > 0 ? $prevProductSqlQuery->row['keyword']: '';
$nextProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$nextProductId'";
$nextProductSqlQuery = $this->db->query($nextProductSql);
$nextProductURL = count($nextProductSqlQuery->rows) > 0 ? $nextProductSqlQuery->row['keyword']: '';
$nextPrevProduct['prev_product'] = (trim($prevProductURL) != '') ? $cateURL . "/" . $prevProductURL : '';
$nextPrevProduct['next_product'] = (trim($nextProductURL) != '') ? $cateURL . "/" . $nextProductURL : '';
}
}
}
return $nextPrevProduct;
}
And last go to product.tpl and add this code where ever you want buttons and style it the way you want.
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default/template/pages/product/product.tpl#L268
<?php if(is_array($nextPrevProducts)){ ?>
<div>
<div style="float: left">
<?php if(trim($nextPrevProducts['prev_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['prev_product']); ?>" > Previous Product </a>
<?php } ?>
</div>
<div style="float: right">
<?php if(trim($nextPrevProducts['next_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['next_product']); ?>" > Next Product </a>
<?php } ?>
</div>
</div>
<?php } ?>
You can contact AbanteCart developers (they have paid service abantecart.com/contact-us) or some other developers https://www.fiverr.com/nattoben This developer has made few extension for AbanteCart he might be able to help you https://marketplace.abantecart.com/index.php?rt=product/vendor&v=40
P.S I am not promoting anyone here just trying to help you as what you want is not an easy thing. It needs some custom development
-
Have you tried this?
-
Not tried
i need to get local install my website but some error on it. so after that i will try code and inform you thanks :)
-
:) :) ok you need to put this code in file best of luck
storefront\view\default\template\common\header.tpl
YES MY FRIEND!
I knew it. thanks a lot.
I have a question about something. can i contact you privately please??
regards
-
You will need to edit core code to get this. Better option is to make an extension
But try this if it works for you because I think you have some custom code already:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/product/product.php#L750
if(isset($category_info) && count($category_info) > 0){
$nextPrevProducts = $this->model_catalog_product->getProductNextPrevProducts($product_id, $category_info['category_id']);
$this->data['nextPrevProducts'] = $nextPrevProducts;
}
right above foreach ($results as $result) {
-----
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/catalog/product.php
Add this before last } line
public function getProductNextPrevProducts($productId, $categoryId){
$sql = "SELECT * FROM " . $this->db->table("products_to_categories") . " WHERE `category_id` = $categoryId and product_id in ( select product_id from " . $this->db->table("products") . " where STATUS = 1)";
$query = $this->db->query($sql);
$product_data = $query->rows;
$nextPrevProduct = array();
if(count($product_data) > 0){
foreach($product_data as $k => $v){
if($v['product_id'] == $productId){
$preProductId = isset($product_data[$k - 1]['product_id']) ? $product_data[$k - 1]['product_id'] : 0;
$nextProductId = isset($product_data[$k + 1]['product_id']) ? $product_data[$k + 1]['product_id'] : 0;
$cateSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'category_id=$categoryId'";
$cateSqlQuery = $this->db->query($cateSql);
$cateURL = count($cateSqlQuery->rows) > 0 ? $cateSqlQuery->row['keyword']: '';
$prevProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$preProductId'";
$prevProductSqlQuery = $this->db->query($prevProductSql);
$prevProductURL = count($prevProductSqlQuery->rows) > 0 ? $prevProductSqlQuery->row['keyword']: '';
$nextProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$nextProductId'";
$nextProductSqlQuery = $this->db->query($nextProductSql);
$nextProductURL = count($nextProductSqlQuery->rows) > 0 ? $nextProductSqlQuery->row['keyword']: '';
$nextPrevProduct['prev_product'] = (trim($prevProductURL) != '') ? $cateURL . "/" . $prevProductURL : '';
$nextPrevProduct['next_product'] = (trim($nextProductURL) != '') ? $cateURL . "/" . $nextProductURL : '';
}
}
}
return $nextPrevProduct;
}
And last go to product.tpl and add this code where ever you want buttons and style it the way you want.
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default/template/pages/product/product.tpl#L268
<?php if(is_array($nextPrevProducts)){ ?>
<div>
<div style="float: left">
<?php if(trim($nextPrevProducts['prev_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['prev_product']); ?>" > Previous Product </a>
<?php } ?>
</div>
<div style="float: right">
<?php if(trim($nextPrevProducts['next_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['next_product']); ?>" > Next Product </a>
<?php } ?>
</div>
</div>
<?php } ?>
You can contact AbanteCart developers (they have paid service abantecart.com/contact-us) or some other developers https://www.fiverr.com/nattoben This developer has made few extension for AbanteCart he might be able to help you https://marketplace.abantecart.com/index.php?rt=product/vendor&v=40
P.S I am not promoting anyone here just trying to help you as what you want is not an easy thing. It needs some custom development
Nice work and Thanks you so much :) :) :) :) :)
i am just try your code today in my local server but its show me some error.i am just put your code for new install abantecart in localhost and add your above code in it.
/storefront/controller/pages/product/product.php#L750
$results = $this->model_catalog_product->getProductTags($product_id);
/* Sam_78*/
if(isset($category_info) && count($category_info) > 0){
$nextPrevProducts = $this->model_catalog_product->getProductNextPrevProducts($product_id, $category_info['category_id']);
$this->data['nextPrevProducts'] = $nextPrevProducts;
}
/* Sam_78*/
storefront/model/catalog/product.php
this code also add after add this code it's start error to show i was put code as after
public function hasTrackOptions{} function is end and also add last line before } this.
i am attach image of error to show.
thanks you so much :) :) :) :)
-
what error are you getting? send errors from error log file so I can look at it.
-
what error are you getting? send errors from error log file so I can look at it.
Thanks you so much for replay
Above error is database name table error which i was change and now i was update in live project but Previous Product and next product link not show in page or not get value of product id. i was attach image that not id get.
As per above code add in all file in live project http://1intl.com
Thanks so much :) :) :)
-
Thanks :) :) :) :) :)
attach all there file with code but data is not display id.
-
hi!
Did you fixed that ??
-
hi!
Did you fixed that ??
Thanks
No sir i can't fix it.there is no date was found.in query
-
Thanks :) :) :)
i am also try to display id with this
<?php echo "<pre>"; print_r($nextPrevProducts['prev_product']);exit;?>
but no data was display??????
-
Yes that's because you are not using SEO url's
Can you try this https://abantecart.atlassian.net/wiki/spaces/AD/pages/7962664/SEO+URL+s
Right now your url is http://1intl.com/10121?product_id=382 which is not good for SEO as url doesn't mean anything to google or any other search engine. Once you have SEO url turned on you will have table url_aliases which will have values like query = product_id=382 keyword= shirt-pant
and my code will work. I have tested it on fresh install and it worked for me.
-
Thanks bro Sam_78 your awesome great your great's in this filed bro.
Thanks you very much bro :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
He is nice and great skill in this filed.
Thanks Sam_78 very much
-
Thanks bro Sam_78 your awesome great your great's in this filed bro.
Thanks you very much bro :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
He is nice and great skill in this filed.
Thanks Sam_78 very much
hi!
Can you write step by step the details of your experience in this subject please ??
Regards
HADY
-
Thanks bro Sam_78 your awesome great your great's in this filed bro.
Thanks you very much bro :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
He is nice and great skill in this filed.
Thanks Sam_78 very much
Hi I am happy it worked for you. Send me your URL once you are done with implementing this
-
Thanks bro Sam_78 your awesome great your great's in this filed bro.
Thanks you very much bro :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
He is nice and great skill in this filed.
Thanks Sam_78 very much
Hi I am happy it worked for you. Send me your URL once you are done with implementing this
Thanks
Currently only my few product is work because of SEO URL when i was import products it's not generate SEO Name so And also my SEO url work.Here is url
http://1intl.com/10367--s-28/10367-01
http://1intl.com/10359-s-30/10359-02
Also i will do change seo link of product. So next my all website work properly.
Thanks & Regards
-
Thanks bro Sam_78 your awesome great your great's in this filed bro.
Thanks you very much bro :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
He is nice and great skill in this filed.
Thanks Sam_78 very much
Hi I am happy it worked for you. Send me your URL once you are done with implementing this
Thanks :) :) :) sam_78 :) :) :) :) :) i was done in my website next preview button completed today i get error in some my product delete and change it so some time it's redirect me to other page and i was fixed today of all my products.Thanks Sam_78 so much :) :) :) my website link as below
http://1intl.com
-
nice introduction background video, congratulations.
-
nice introduction background video, congratulations.
I was complete product page next preview button update in website replay not video bro :P :P :P :P
-
I also want to apply for my website .
-
You will need to edit core code to get this. Better option is to make an extension
But try this if it works for you because I think you have some custom code already:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/product/product.php#L750
if(isset($category_info) && count($category_info) > 0){
$nextPrevProducts = $this->model_catalog_product->getProductNextPrevProducts($product_id, $category_info['category_id']);
$this->data['nextPrevProducts'] = $nextPrevProducts;
}
right above foreach ($results as $result) {
-----
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/catalog/product.php
Add this before last } line
public function getProductNextPrevProducts($productId, $categoryId){
$sql = "SELECT * FROM " . $this->db->table("products_to_categories") . " WHERE `category_id` = $categoryId and product_id in ( select product_id from " . $this->db->table("products") . " where STATUS = 1)";
$query = $this->db->query($sql);
$product_data = $query->rows;
$nextPrevProduct = array();
if(count($product_data) > 0){
foreach($product_data as $k => $v){
if($v['product_id'] == $productId){
$preProductId = isset($product_data[$k - 1]['product_id']) ? $product_data[$k - 1]['product_id'] : 0;
$nextProductId = isset($product_data[$k + 1]['product_id']) ? $product_data[$k + 1]['product_id'] : 0;
$cateSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'category_id=$categoryId'";
$cateSqlQuery = $this->db->query($cateSql);
$cateURL = count($cateSqlQuery->rows) > 0 ? $cateSqlQuery->row['keyword']: '';
$prevProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$preProductId'";
$prevProductSqlQuery = $this->db->query($prevProductSql);
$prevProductURL = count($prevProductSqlQuery->rows) > 0 ? $prevProductSqlQuery->row['keyword']: '';
$nextProductSql = "SELECT keyword FROM `url_aliases` WHERE `query` LIKE 'product_id=$nextProductId'";
$nextProductSqlQuery = $this->db->query($nextProductSql);
$nextProductURL = count($nextProductSqlQuery->rows) > 0 ? $nextProductSqlQuery->row['keyword']: '';
$nextPrevProduct['prev_product'] = (trim($prevProductURL) != '') ? $cateURL . "/" . $prevProductURL : '';
$nextPrevProduct['next_product'] = (trim($nextProductURL) != '') ? $cateURL . "/" . $nextProductURL : '';
}
}
}
return $nextPrevProduct;
}
And last go to product.tpl and add this code where ever you want buttons and style it the way you want.
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default/template/pages/product/product.tpl#L268
<?php if(is_array($nextPrevProducts)){ ?>
<div>
<div style="float: left">
<?php if(trim($nextPrevProducts['prev_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['prev_product']); ?>" > Previous Product </a>
<?php } ?>
</div>
<div style="float: right">
<?php if(trim($nextPrevProducts['next_product']) != '') {?>
<a href="<?php echo trim($nextPrevProducts['next_product']); ?>" > Next Product </a>
<?php } ?>
</div>
</div>
<?php } ?>
You can contact AbanteCart developers (they have paid service abantecart.com/contact-us) or some other developers https://www.fiverr.com/nattoben This developer has made few extension for AbanteCart he might be able to help you https://marketplace.abantecart.com/index.php?rt=product/vendor&v=40
P.S I am not promoting anyone here just trying to help you as what you want is not an easy thing. It needs some custom development