I
I
illuzii2017-05-19 12:10:00
JavaScript
illuzii, 2017-05-19 12:10:00

How to insert goods from the store of goods (Showcases) Vkontakte on your website?

Hello, can anyone come across tell me. VKontakte has such an opportunity to make its own market with goods ( Showcase of goods ). How can this showcase be inserted into the client's website. Tried through iframe - does not display anything. Maybe there is a way through jQuery. The VK API allows you to insert a Page into the site, but not a Showcase.
The task is that in this block on the site there was no vertical and horizontal scrolling, it was indexed by search engines. When clicking on a product, a lightbox was opened with a detailed description from VK.
Writing a parser is not an option - I'm not a programmer, maybe there is an easier way.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2017-05-19
@Fzero0

We get the key, make the application as described here,
and then you can set your owner_id=-814&access_token=???????
<ul id="q1" class="cards"></ul>

function GoodsView (obj) {
    return `<li class="cards_item">
    <div class="card">
    	<div class="card_image">
         <img src="${obj.thumb_photo}" />
       </div>
       	<div class="card_content">
                <h2 class="card_heading">${obj.title}</h2>
                <p>	Цена  : ${obj.price.text} <br>
        ${obj.description}</p>
                <a href="#" class="card_button">Button</a>
      			</div>    	
      </div> 
    </li>`
  }
const vkGetData = {
  goods: function() {
    return $.ajax({
    url:'https://api.vk.com/method/market.get?owner_id=-81454608&access_token=???????&v=5.59',
    dataType: 'jsonp'})
    .then((data)=> {
    	console.log(data)
      return data.response.items;
    })
    .then((data)=>{
        let listGoods = '';
        data.forEach((item) => {
          listGoods += GoodsView(item);
        })
        return listGoods;
    });
  }
};
vkGetData.goods().done((arr)=> {
  $('#q1').append(arr)
});

But it's better to do everything on the server side (for example, in php)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question